I am curious about the way implicitly unwrapped optionals work, in the Apple reference book - The Swift Programming Language it states:
“If you try to access an implicitly unwrapped optional when it does not contain a value, you will trigger a runtime error. The result is exactly the same as if you place an exclamation mark after a normal optional that does not contain a value.”
If I try and access a valueless optional without an exclamation mark you get an error as stated above.
var optionalVar:String?
println("VAR: \(optionalVar!)")
If however you try an access an implicitly unwrapped optional that does not contain a value the println outputs VAR: nil
which is not what is stated above.
var implicitOpt:String!
println("VAR: \(implicitOpt)")
Can anyone clarify this, is it badly worded docs, me miss understanding, a bug?