Created
July 11, 2017 16:24
-
-
Save iThinker/55cdf222ff0e663538319610e99d98be to your computer and use it in GitHub Desktop.
This file contains 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 characters
func performWithErrorPointer<T>(_ executable: @autoclosure @escaping () throws -> T, _ errorPointer: NSErrorPointer) -> T? { | |
do { | |
return try executable() | |
} | |
catch let error { | |
errorPointer?.pointee = error as NSError | |
return nil | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment