(no title)
nottombrown | 11 years ago
extension Optional {
func try<U>(f: (T) -> U) -> Optional<U> {
if let unwrapped = self {
return f(unwrapped)
} else {
return nil
}
}
}
You can see how to use it in this gist:
No comments yet.