With Swift 3, it seems like explicitly unwrapped optionals are no longer unwrapped. I'm not seeing this in the swift 3 migration guide notes. Can somebody help me understand the new rules on this? For example:
class Foo {
var something: Int!
}That's a very commpon pattern when using segue assignments. It seems now though all through my code I have to say something! (with the !) instead of just something. That means it's not really unwrapping any longer.
Confused...
The only change I saw in recent months was how IUOs worked with reference types. Example:
class Bar {
func doWork() { }
}
class Foo {
var bar : Bar!
init() {
bar = Bar()
}
func doWork() {
bar.doWork()
let theBar = bar
theBar?.doWork()
}
}If doing directy ivar access, no need to unwrap. But if assigning the IUO to a local variable ('theBar' above), you then need to work with it differently.
I cannot speak to any changes regarding value types as in my current projects, I only use IUO for reference types (just how things turned out for me).