When writing Swift code, it is not uncommon to forget to unwrap optionals. The 
compiler will offer a fixit, telling you you must insert either a ? or a !. 
However, when you accept the fixit, ! is inserted (at least, it is for me in 
Xcode 8.3).

Ideally the fixit would default to ? because this is the preferred option; ! is 
often a sign of non-Swifty code and does not interact well with idiomatic Swift 
constructs such as if-let-(as?), guard-let-(as?)-else, etc. Also I think it’s 
safe to say that fixits should not err on the side of crashing at runtime.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to