The dark secret of Optional in Swift is all the extensions that make it work magic in situations far beyond the sugary ? ?? !
Disappointing, really, when someone finds the purloined letter hiding in plain sight and then... doesn't open it?? :)
Disappointing, really, when someone finds the purloined letter hiding in plain sight and then... doesn't open it?? :)
func foo(string: Optional<String>) { . . . }
let string: String = "just a string"
foo(string: string)Edit: 'Binding' uses the PropertyWrapper attribute, which is similar in that it allows treating a wrapper type like the type it wraps. This is a language feature that is available to users. I'd be interested to know if Optional is the only "magical" type.