Skip to content

PHPickerConfiguration ​

PHPickerConfiguration represents the configuration of the photo picker: how many items can be selected at most, which types are shown, how selection works, and what the picker looks like.

The configuration is copied when a PHPickerViewController is created. Changing the configuration object afterwards doesn't affect pickers already created. Its properties have no change notifications: only the app can change them.

You need to install @nacrejs/photos first; for how, see PHPickerViewController, or see Core and capability packages.

Inheritance: NSObject → PHPickerConfiguration

Constructor ​

PHPickerConfiguration()

Creates a configuration with all default values: at most 1 item, all types shown.

Instance properties ​

PropertyDescription
selectionLimitThe maximum number of items. 0 means no limit
filterWhich types are shown. null means all
preferredAssetRepresentationModeWhich format to give when an item has several
selectionHow selection works: checkmarks, numbers, notification on every selection
modeWhat the picker looks like: full, or just a row of thumbnails

Examples ​

js
const config = new PHPickerConfiguration();
config.filter = PHPickerFilter.imagesFilter;
config.selectionLimit = 9;
config.selection = 'ordered';
const picker = new PHPickerViewController(config);

Effect: creates a photo picker that, once presented, shows only images, allows up to 9 to be selected, and shows on each selected image the order in which it was selected. The on-screen effect is not verified in the simulator.

Corresponding iOS API ​

ObjCJS
[[PHPickerConfiguration alloc] init]new PHPickerConfiguration()
config.selectionLimit = 3config.selectionLimit = 3
config.filter = PHPickerFilter.imagesFilterconfig.filter = PHPickerFilter.imagesFilter
config.selection = PHPickerConfigurationSelectionOrderedconfig.selection = 'ordered'

See also ​