Created
February 21, 2018 11:05
-
-
Save federicocappelli/ba95be8a28c0aa6d9597a50fc1c12b07 to your computer and use it in GitHub Desktop.
iOS Error management snippet 2
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 getDataFromUrl(url: URL, completion:(_ data: Data?, _ error: NSError?) -> Void) { | |
... | |
if (error) { | |
// Show error in UIAlertcontroller | |
//or | |
//send it up with a delegate/completion block to the higher level of the app. | |
} | |
else if (data) { | |
// Do something | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment