Last active
April 20, 2022 14:55
-
-
Save sigidhanafi/7f60f0da50eca098bd20075628513e5e to your computer and use it in GitHub Desktop.
handle error in swift
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 characters
// Step 3 use do try catch | |
let urlString = "" | |
do { | |
let result = try validateUrl(urlString: urlString) | |
// Step 5 continue the process if it success | |
print("is url valid? \(result)") | |
} | |
catch { | |
// Step 4 show error to users | |
print("error \(error)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment