[swift-evolution] Proposal Sketch: simplify optional unwrapping syntax

Kyle Carson kyleacarson at gmail.com
Mon Dec 21 20:36:28 CST 2015


I've got another solution.  It's simple and very "swift".  The code "var != nil" can be used as a hint to the compiler that *var* is not an optional.

Code example:

let color : Color? = getFavoriteColor()
if color != nil {
	// Color is no longer an Optional
}



More information about the swift-evolution mailing list