Skip to content

Instantly share code, notes, and snippets.

@milesegan
Created June 23, 2016 02:04
Show Gist options
  • Save milesegan/8a1284e531700e28ad16d1a643a016e2 to your computer and use it in GitHub Desktop.
Save milesegan/8a1284e531700e28ad16d1a643a016e2 to your computer and use it in GitHub Desktop.
extension Optional {
public func flatCall(@noescape f: (Wrapped) throws -> Void) rethrows -> Void {
switch self {
case .Some(let wrapped):
try f(wrapped)
case .None:
break
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment