SwiftUI
wrapper of ContactsUI
's CNContactPickerViewController
. Eventually, I'll add the rest of the framework.
- Port over macOS-exclusive ViewControllers (
CNContactViewController
's usage on macOS, andCNContactPicker
).
Documentation for SwiftUIContacts
is hosted on Swift Package Index.
ContactPicker
supports four different selection modes and the mode is decided by which init
you use:
- A single contact
- Use a
@Binding
of typeCNContact?
in theinit
- Use a
- Multiple contacts
- Use a
@Binding
of type[CNContact]
in theinit
- Use a
- A single property of a contact
- Use a
@Binding
of typeCNContactProperty?
in theinit
- Use a
- A single property from multiple contacts
- Use a
@Binding
of type[CNContactProperty]
in theinit
- Use a
.sheet(isPresented: $showSheet) {
ContactPicker(selection: $selectedProperty,
displayedPropertyKeys: [.phoneNumbersKey]
)
}