PHPickerViewController() constructor
The PHPickerViewController() constructor creates a photo picker from a configuration. Creating it doesn't present anything; present it with the view controller's presentViewController().
Syntax
new PHPickerViewController(configuration)Parameters
configuration
A PHPickerConfiguration, required. The configuration is copied here: changing this configuration object afterward doesn't affect the created picker. Read the copy from configuration.
Return value
A new PHPickerViewController. It hasn't been presented yet; presentingViewController is null.
Exceptions
TypeError
No configuration given, or what's given isn't a PHPickerConfiguration:
new PHPickerViewController needs a PHPickerConfiguration, got undefinedDescription
Create a new picker each time the user picks photos. What happens if the same picker is presented a second time is not verified in the simulator.
Examples
const config = new PHPickerConfiguration();
config.selectionLimit = 3;
const picker = new PHPickerViewController(config);
config.selectionLimit = 5;
console.log(picker.configuration.selectionLimit);Result: Prints 3. Changing the original configuration after construction doesn't change the picker's copy.
Corresponding iOS API
-[PHPickerViewController initWithConfiguration:].
See also
PHPickerConfiguration: what's in a configurationpick: fires when the user finishes picking- This class belongs to the
@nacrejs/photospackage; for how to install it, see Install first