5 ms·
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
by dep_b 9y ago
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 versions of Xcode 8 at least. But that was too late for me.
Apart from that it's a big step forward, less wordy than Objective-C yet it's still "readable language" instead of a bunch of almost random generic English words.
I'm not sure about async / await. Whenever I deal with it in .Net languages I never find it that intuitive compared to blocks. But you know every programmer suffers from Stockholm Syndrome at least a bit so it could just be my mind warped to not only accepting but even glorifying the flaws in a language.
There are people out there that genuinely like JavaScript for instance!
- eschaton 9y agoYou 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?
- rudedogg 9y agoWhat's the advantage of using URL versus strings? The networking libraries I've worked with just use string interpolation: https://github.com/Moya/Moya/blob/master/docs/Targets.md https://github.com/Moya/Moya/blob/master/docs/Targets.md https://github.com/Alamofire/Alamofire#routing-requests https://github.com/Alamofire/Alamofire#routing-requests
- dep_b 9y agoActually 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.