I'm downloading files using a dataTaskPublisher - and the actual download is going great. What I'm wondering is if there is any way to show the "percent downloaded"?
Here's my code:
Here's my code:
Code Block swift cancellable = URLSession.shared.dataTaskPublisher(for: url) .map { UIImage(data: $0.data) } .replaceError(with: nil) .handleEvents(receiveSubscription: { [weak self] _ in self?.onStart() }, receiveOutput: { [weak self] in self?.cache($0, id) }, receiveCompletion: { [weak self] _ in self?.onFinish() }, receiveCancel: { [weak self] in self?.onFinish() }) .subscribe(on: Self.imageProcessingQueue) .receive(on: DispatchQueue.main) .sink { [weak self] in self?.image = $0 }