Skip to content

Instantly share code, notes, and snippets.

@vialyx
Created November 8, 2018 04:05
Show Gist options
  • Save vialyx/35fd1100e543ed4323fc2095fad52e35 to your computer and use it in GitHub Desktop.
Save vialyx/35fd1100e543ed4323fc2095fad52e35 to your computer and use it in GitHub Desktop.
import UIKit
final class ViewController: UIViewController {
let apiClient = APIClient()
override func viewDidLoad() {
super.viewDidLoad()
let resource = Resource(url: URL(string: "https://desolate-beyond-86929.herokuapp.com/arrival")!)
apiClient.load(resource) { (result) in
switch result {
case .success(let data):
print("\(self) retrive data: \(String(data: data, encoding: .utf8)) from resource: \(resource)")
case .failure(let error):
print("\(self) retrive error: \(error) from resource: \(resource)")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment