Created
May 3, 2020 20:24
-
-
Save masliukivskyi/9dd513d4ab45c0a1ef979eefa2ce8aa4 to your computer and use it in GitHub Desktop.
Combining
This file contains hidden or 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
_ = dataProvider | |
.decode(type: DummyDecodable.self, decoder: JSONDecoder()) | |
.map({ (decodable) -> String in | |
return "The user is \(decodable.userName) and his id is \(decodable.userId)" | |
}) | |
.sink(receiveCompletion: { completion in | |
print(completion) | |
}, receiveValue: { response in | |
print(response) | |
}) | |
dataProvider.send(Data("{\"userName\":\"Alex\",\"userId\":1}".utf8)) | |
Output: The user is Alex and his id is 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment