Skip to content

Instantly share code, notes, and snippets.

@mjhassan
Last active September 3, 2019 04:39
Show Gist options
  • Select an option

  • Save mjhassan/9ea9d69bd93a958b986d42019c5ded6a to your computer and use it in GitHub Desktop.

Select an option

Save mjhassan/9ea9d69bd93a958b986d42019c5ded6a to your computer and use it in GitHub Desktop.
Simple service class template for NSCache example
class APIService: ServiceProtocol {
func get( url: URL, callback: @escaping (_ data: Data?, _ error: Error?) -> Void ) {
URLSession.shared.dataTask(with: url) { (data, _, error) in
callback(data, error)
}.resume()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment