In iOS 14.0, Apple introduced a new way to pick images from the device’s photo library using PHPickerViewController. (If you are not aware of PHPickerViewController, I strongly recommend you to read about PHPickerViewController first.)

Different apps have different requirements. For example, a hi-res video editing app might be interested in showing cinematic videos and videos. A screenshot stitching app might be interested in showing screenshots upfront. From iOS 16.0, Apple has introduced new APIs, making filtering media very easy. If your app wants to show cinematic videos, you can use the cinematicVideos enum.

PHPickerViewController example of filtering cinematic videos

var configuration = PHPickerConfiguration()
configuration.filter = .cinematicVideos
let picker = PHPickerViewController(configuration: configuration)
present(picker, animated: true)

Similarly, you can filter screenshots, screenRecordings, depthEffectPhotos, and much more. You can read the PHPickerFilter documentation to learn more about the new filter enums.

To filter only screenshots

configuration.filter = .screenshots

To filter only screen recordings

configuration.filter = .screenRecordings

To filter only depth effect photos

configuration.filter = .depthEffectPhotos

The best part is that all the filters except cinematicVideos , depthEffectPhotos, and bursts are backported to iOS 15.0 You can also add compound filters and refine your media results using all and not . They are also backported to iOS 15.0

References

[1] What’s new in the Photos picker

[2] PHPickerViewController

About the author

Support creators

Show your support to indie devs by downloading their apps from the banner displayed below. It will help them build great apps in these tough times.