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:
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
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
I'm trying to dynamically add a UIImage that is in memory (that is dynamically created at runtime and changed over time) to a RealityKit scene. I see with TextureResource that I can easily do this by creating a material from an image file in my bundle, but I don't see any way to do this with just a UIImage. Is there another way to go about this that I'm just missing? Any help would be appreciated!