I have seen this example before, but no other - and even without nested Optional
s, this could still be modeled (maybe even better):
dict.keys.contains
wouldn't need any comment to explain its meaning, and with optionals that are modeled as T | Nil
, it's possible to construct a dictionary whose return value is T | Nil | NoValue
.
Obviously, this ship has sailed long ago for Swift - but that is no reason to glorify nested Optional
s.