3 ms·
Good news - it does. For me, it fixed a lot of bugs that I had no idea existed. Seems like a pretty easy mistake to make, since third party libraries I use wer
by jordansmithnz 10y ago
Good news - it does. For me, it fixed a lot of bugs that I had no idea existed.
Seems like a pretty easy mistake to make, since third party libraries I use were littered with exactly the same mistake.
- dep_b 10y agoYep it was a really nasty one. Because it used to work differently in Swift 2.x where it would not put Optional() around it in certain circumstances.
- glhaynes 10y agoInteresting, I don't remember noticing it behaving that way. What were the circumstances, if you recall?
- slavapestov 10y agoI think there were differences around calling .description versus .debugDescription when a type is converted to a String, which had some odd behavior with Optional. I think there was an evolution thread about this but you'll have to Google it yourself since I'm on my phone right now :-)
- dep_b 10y agovar someInt: Int! // class parameter // later, in a method let url = "/api/bla/\(someInt)" In Swift 2.x it would simply show the value of someInt. Now it will print Optional. The problem is described in the linked Stack Overflow question as well. I never program like that but there's a ton of people out there that convince the compiler they're going to set that value in time even when it's not set when init is called. Just like some people (including Apple!) use this pattern for setting outlets: IBOutlet var someLabel: UILabel!