Why not make optional a SequenceType? This works really well in Scala and provides the desired functionality via forEach. <span></span><br><br>On Friday, 11 March 2016, Lammert Westerhoff via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Currently the Swift Optional doesn’t have an ifPresent function. <br>This function is much like the map function except that the passed in function always returns Void. Almost the same can be done with the mapfunction, however the map function gives a compiler warning if it&#39;s result is unused. Also a map function can be ambiguous when there are multiple functions with the same name. The ifPresent will always pick the right function; i.e. the one returning Void and therefore is not ambiguous .<br><br>The ifPresent function is like the map function very powerful. Some examples of its usage:<br><br><div>let mapView: MKMapView = ... // some map view</div><div>let annotation: MKAnnotation? = ... // some optional annotation</div><div>annotation.ifPresent(mapView.addAnnotation)</div><br>I also wrote a Blog Post about this topic in which I present it as an extension of Optional with some more examples where I find it very useful: <a href="https://swiftforward.wordpress.com/2015/12/04/add-ifpresent-to-swift-optionals/" target="_blank">https://swiftforward.wordpress.com/2015/12/04/add-ifpresent-to-swift-optionals/</a><div><br></div><div>The implementation can be as simple as following:</div><div><br>public func ifPresent(@noescape f: (Wrapped) throws -&gt; Void) rethrows {<br>   _ = try map(f)<br>}</div><div><br></div><div>—</div><div>Lammert Westerhoff</div></div></blockquote><br><br>-- <br>-- Howard.<br>