Menu

1 / 2

Loading 100 Photos from PHPicker Without Freezing: Order, Progress and Cancellation in Swift

DEV Community: swift·Maxwell·5 days ago
#aBOQX0RC
#devtoswift#devto#dev#progress#folder
Reading 0:00
15s threshold

Someone selects 80 photos in the system picker, taps Add, and your app goes quiet. No spinner, no count, just a frozen sheet while the item providers grind through iCloud downloads in whatever order they finish. When the results finally arrive, photo 37 is in slot 2, two files are missing, and nobody knows why.

PHPickerViewController is the right tool for picking photos on iOS: no full library permission, the system handles the UI, and it supports multi-select. But the part after picker(_:didFinishPicking:) is all yours, and that is where batch apps tend to go wrong. This post covers the loading side: keeping the user's order, copying files before they vanish, limiting concurrency, showing honest progress, and letting people cancel.

I build BatchMark, an on-device batch photo app, and this is the stage that runs before any batch watermark or filter touches a pixel.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.