Forked from riteshhgupta/swift-snippet-9.swift
Last active
February 25, 2017 12:33
-
-
Save maciejpiotrowski89/db1932cb8a71ef4b970bb43cb09f3d68 to your computer and use it in GitHub Desktop.
Revisions
-
maciejpiotrowski89 renamed this gist
Feb 25, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
riteshhgupta created this gist
Feb 6, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ extension Optional { // `then` function executes the closure if there is some value func then(_ handler: (Wrapped) -> Void) { switch self { case .some(let wrapped): return handler(wrapped) case .none: break } } }