Live data from Hacker News

Swift's Evolution

carpeaqua.com

101–105 of 105 posts

Re: Swift's Evolution

#101
post #29

And I thought 2017 is the year when I start a new app in swift... guess will be sticking to objc and react native depending on what makes sense where.

I'm with you. I see few advantages of switching my large existing codebase to swift, only disadvantages. Maybe in a few years the balance will change.

> I see few advantages of switching my large existing codebase to swift

There are none. Don't transition an existing, stable ObjC project. I don't understand why this is a thought anyone would entertain, especially since ObjC itself isn't going anywhere.

If you are starting a new project in Swift and it will be pure Swift, that's fine. Go for it. Do not attempt to migrate existing ObjC projects or use Swift in them.

Re: Swift's Evolution

#103
post #10

Will Kotlin Native be able to compete with Swift on iOS? The syntax is very similar and it would make for a nice cross platform PL. I was holding off on Swift to see where it was going, but I'd like to add iOS to my dev targets. Objective-C was too verbose for me years ago, but I've heard it has changed a bunch.

I'm curious to see if the porting from Java to Kotlin on Android apps will prove to be as challenging- and frustrating- as people have described the shift from Objective-C to Swift.

There is literally zero friction between Kotlin and Java since they're interoperable. You can even translate Java files to Kotlin files by selecting a menu option in Android Studio or even cutting and pasting Java into a Kotlin file. Sure, the code may not be optimized fully, but it's a good starting point. Additionally, you can even mix Java and Kotlin files in a project.

Re: Swift's Evolution

#104

And I thought 2017 is the year when I start a new app in swift... guess will be sticking to objc and react native depending on what makes sense where.

I am actually working on a react native app with native modules in objc, swift, and a combination of the two. It is stable and easy to work with all three. Just use what you want to use. You wanna make it full swift, go for it. React native, go for it. Stick with objc you know, go for it. No wrong choice here.

ps: Well, maybe pure objc is not the best choice, since it's on its way out, but it's a long way to its end.

Re: Swift's Evolution

#105
post #46

I didn't have a really rough time with the Big Rename but some subtle differences bit me, simply the way how strings are constructed for example: var someId: Int! ... let urlString = "\(baseUrl)/\(route)/\(someId)" Result in Swift 2: "http://ac.me/products/123" result in Swift 3: "http://ac.me/products/Optional(123)" Happy hunting! Some of this ended up in production :( They've changed it to a warning in later versio…

You should be using the methods on the URL struct to compose a URL, rather than string interpolation. You wouldn't use string interpolation or concatenation to compose an SQL query, would you?

Actually it's behaviour seemed to be geared more towards debugging than actual string formatting. The expected behaviour should be either a compile error, or the value when it's set and nothing, nil or None if it would be allowed to compile.
Post reply on HN