Skip to content

Instantly share code, notes, and snippets.

@Andrea-Scuderi
Last active August 1, 2019 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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: "user2@example.com", 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