Last active
November 8, 2016 10:18
-
-
Save minhwang/ac46f3056bd14705df5ff3a1641a9351 to your computer and use it in GitHub Desktop.
How to write code to request GET data using String object.
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 requestGETUsingString(stringURL url:String) { | |
guard let url: URL = URL(string: url) else { | |
print("URL is invalid..!!") | |
return | |
} | |
guard let result = try? String(contentsOf: url) else { | |
print("Error occurred while getting data..!!") | |
return | |
} | |
print(result) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment