[swift-evolution] Shorthand unwrap proposal

James Campbell james at supmenow.com
Thu Jun 23 10:36:53 CDT 2016

I was wondering if people would be open to adding an unwrap method to the
Optional type,  I already have a method like this which shortens code for

So this:

let myReallyLongOptionalName: String? = "Hey"

if let string = myReallyLongOptionalName {

Could become"

let myReallyLongOptionalName: String? = "Hey"

myReallyLongOptionalName.unwrap {

The block would only be fired if myReallyLongOptionalName has a value.


*James⎥Head of Trolls*

*james at supmenow.com <james at supmenow.com>⎥supmenow.com <http://supmenow.com>*


*Runway East *

*10 Finsbury Square*


* EC2A 1AF *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160623/a2009625/attachment.html>

More information about the swift-evolution mailing list