Hi, why we did not check the isCancelled on "searchHandle" because we already have the reference of the current running task could you please help me for this confusion
Hey Great video.... I have a question about using 'Task' ...so when using async / await use 'Task' to cancel and make search results appear in the correct order.... then is it correct when NOT using async / await we use Set and then call .store() after the receive and sink calls ?
So when using Combine, you would use switchToLatest() to cancel any previous requests: $searchTerm .debounce(for: 0.8, scheduler: RunLoop.main) .removeDuplicates() .map { searchTerm -> AnyPublisher in self.searchBooks(searchTerm: searchTerm) } .switchToLatest() .receive(on: RunLoop.main) .assign(to: &$result) (see gist.github.com/peterfriese/77682a28490c0c11ce2ec49575fca057)
exactly the video i needed to watch, thank you!
Hi, why we did not check the isCancelled on "searchHandle" because we already have the reference of the current running task could you please help me for this confusion
Hey Great video.... I have a question about using 'Task' ...so when using async / await use 'Task' to cancel and make search results appear in the correct order.... then is it correct when NOT using async / await we use Set and then call .store() after the receive and sink calls ?
So when using Combine, you would use switchToLatest() to cancel any previous requests:
$searchTerm
.debounce(for: 0.8, scheduler: RunLoop.main)
.removeDuplicates()
.map { searchTerm -> AnyPublisher in
self.searchBooks(searchTerm: searchTerm)
}
.switchToLatest()
.receive(on: RunLoop.main)
.assign(to: &$result)
(see gist.github.com/peterfriese/77682a28490c0c11ce2ec49575fca057)