Skip to content

Instantly share code, notes, and snippets.

@Andrea-Scuderi
Last active August 1, 2019 10:18
Show Gist options
  • Save Andrea-Scuderi/89b99add2246ad828070411e6271b7b6 to your computer and use it in GitHub Desktop.
Save Andrea-Scuderi/89b99add2246ad828070411e6271b7b6 to your computer and use it in GitHub Desktop.
Combine API - Part 7
//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