Last active
March 13, 2019 16:40
-
-
Save jemai/2aaa8e8a09a1a4c550ad2fb8b6a6ef59 to your computer and use it in GitHub Desktop.
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
struct service: Requester {} | |
func doSomething() { | |
// we are going to call this test api | |
let request = HTTPRequest(url: "http://ip.jsontest.com/") | |
service.execute(ofType: ResponseMapper.self, request: request) { (result) in | |
switch result { | |
case .failure(let error): | |
print(error) | |
case .success(let object): | |
print(object) | |
} | |
} | |
} | |
// the response type | |
struct ResponseMapper: Codable { | |
let ip: String | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment