Customizing Image picker by media type in Swift/Objective-c

740 Views Asked by At

I want to show category wise (like still photo, live photo, video, slow-mo etc) media to select one or more images/video. When user select "Live Photo button" then only live photos would be come. When user select "Slow-mo Button" then only slow-mo videos would be come and so on. I'm trying to use UIImagePickerController but maybe it doesn't support customization.
I've found this library but I always got this error.

Are there any alternative library or approaches available in Swift/Objective-C (iOS version at least 12)?

1

There are 1 best solutions below

4
Alastar On

To achieve this you can use PHPickerViewController

You can play with PHPickerConfigurationto show only certain media types or limiting the max number of selections, for example:

let configuration = PHPickerConfiguration()
configuration.selectionLimit = 10
configuration.filter = .livePhotos

Then init PHPickerViewController with your configuration, and use delegate methods as you wish.

let controller = PHPickerViewController(configuration: configuration)
controller.delegate = self
present(controller, animated: true, completion: nil)