Skip to content

Instantly share code, notes, and snippets.

@serhatsezer
Created November 26, 2018 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serhatsezer/19acf971171a1704bced23ddd92f8813 to your computer and use it in GitHub Desktop.
Save serhatsezer/19acf971171a1704bced23ddd92f8813 to your computer and use it in GitHub Desktop.
// ViewController.swift
func call(user: String) {
gitHubProvider.request(.userProfile(user)) { (result) in
switch result {
case .success(let data):
if let jsonData = try? data.mapJSON() {
print(jsonData)
} else {
print("error parsing to JSON")
}
case .failure(let error):
print(error.localizedDescription)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment