Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 386 Bytes

README.md

File metadata and controls

13 lines (10 loc) · 386 Bytes

CombineHelper

URLSession.DataTaskPublisher

let url = URL(string: "https://jsonplaceholder.typicode.com/todos/1")!
let anyCancellable = session.dataTaskPublisher(for: url)
    .handleResponse(handleRes)
    .strPrint()
    .twoDecode(twDecodable: Result<Todo,TodoError>.self, decoder: JSONDecoder())
    .sink(receiveCompletion: {_ in }, receiveValue: handleResult)