Skip to content

CNContactPickerContactsEvent ​

CNContactPickerContactsEvent represents the user checking several contacts in the system contact picker and tapping Done.

The contactsselect event of CNContactPickerViewController is this class, and contacts is the contacts checked.

It belongs to the @nacrejs/contacts package; for installation, see CNContactPickerViewController.

Inheritance: Event → CNContactPickerContactsEvent

Constructor ​

CNContactPickerContactsEvent()

Creates a CNContactPickerContactsEvent. The runtime creates one itself when it fires the events below; app code can use it to build an event object and fire it with dispatchEvent() to try out a listener.

Instance properties ​

Also inherits the properties of Event; the most commonly used are type and target. The properties below are read-only; assigning to them throws TypeError.

PropertyDescription
contacts read-onlyThe contacts the user checked

These properties live on the prototype, not on the event object itself: Object.keys(event) and { ...event } don't include them, so read them one by one. See Events with fields.

Events that use this class ​

ObjectEvents
CNContactPickerViewControllercontactsselect

It can't be canceled: cancelable is false, and preventDefault() has no effect. After it is fired, the system closes the picker.

Examples ​

js
const page = new UIViewController();
const picker = new CNContactPickerViewController();
picker.addEventListener('contactsselect', (e) => {
  console.log(e instanceof CNContactPickerContactsEvent);
});
page.presentViewController(picker, { animated: true });

Effect: after the user makes a choice in the picker, prints true. Not verified in the simulator.

Corresponding iOS API ​

ObjCJS
contactPicker:didSelectContacts:The contactsselect event
The contacts parameterevent.contacts

See also ​