Last active
August 1, 2019 10:18
-
-
Save Andrea-Scuderi/89b99add2246ad828070411e6271b7b6 to your computer and use it in GitHub Desktop.
Combine API - Part 7
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
//Let's use our brand new Publishers | |
let todoList = [Todo(id: nil, title: "Learn Composite"), | |
Todo(id: nil, title: "Learn SwiftUI")] | |
// use login to get the Bearer Token | |
let cancellableLogin = login(email: "[email protected]", password: "password2") | |
.sink(receiveCompletion: { (completion) in | |
switch completion { | |
case .failure(let error): | |
print(error) | |
case .finished: | |
print("BEARER TOKEN") | |
} | |
}, receiveValue: { response in | |
print(response) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment