[swift-evolution] [Discussion]: Deprecate !-Unwrapping of Optionals

Andrey Tarantsov andrey at tarantsov.com
Tue Mar 1 23:30:02 CST 2016


Strong -1.

My UI code has hundreds of these force-unwraps, mostly on resource
access like UIImage(named: "something")!, to catch naming mistakes and
the like. Making it a method will increase the visual noise
significantly, and I can't even imagine using let's for this.

In general, I consider ! an assertion, and definitely NOT a code smell.
There are many cases where generic code may legitimately return nil, but
I as a developer know that it will never happen in my particular case.

A.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160302/6a6e076f/attachment.html>


More information about the swift-evolution mailing list