5 ms·
Interesting, I don't remember noticing it behaving that way. What were the circumstances, if you recall?
by glhaynes 10y ago
Interesting, 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!