After a drag/drop of an item into my app's collectionView, UIKit shows this progress UI while the data loads:
How do I cancel the loading of the dropped items when the user cancels?
The itemProvider.loadFileRepresentation
completion block is always called without error. What am I missing?
coordinator.session.progress.cancellationHandler = {
Task { @MainActor in
// User canceled the dropped items loading
}
}
for item in coordinator.items {
item.dragItem.itemProvider.loadFileRepresentation(forTypeIdentifier: AVFileType.mov.rawValue) { [ weak self] (videoURL, error) in
// This completion block will get called even after operation was canceled.
}
}