https://github.com/edonv/swiftuicontacts
SwiftUI wrapper of CNContactPickerViewController.
https://github.com/edonv/swiftuicontacts
cncontactpickerviewcontroller contactsui ios macos swiftui
Last synced: about 1 year ago
JSON representation
SwiftUI wrapper of CNContactPickerViewController.
- Host: GitHub
- URL: https://github.com/edonv/swiftuicontacts
- Owner: edonv
- License: mit
- Created: 2023-03-01T22:21:05.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-22T18:30:41.000Z (over 2 years ago)
- Last Synced: 2025-03-24T04:51:39.544Z (over 1 year ago)
- Topics: cncontactpickerviewcontroller, contactsui, ios, macos, swiftui
- Language: Swift
- Homepage:
- Size: 34.2 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# SwiftUIContacts
[](https://swiftpackageindex.com/edonv/SwiftUIContacts)
[](https://swiftpackageindex.com/edonv/SwiftUIContacts)
`SwiftUI` wrapper of [`ContactsUI`](https://developer.apple.com/documentation/contactsui)'s [`CNContactPickerViewController`](https://developer.apple.com/documentation/contactsui/cncontactpickerviewcontroller). Eventually, I'll add the rest of the framework.
## To-Do's
- [ ] Port over macOS-exclusive ViewControllers (`CNContactViewController`'s usage on macOS, and `CNContactPicker`).
## Documentation
Documentation for `SwiftUIContacts` is hosted on [Swift Package Index](https://swiftpackageindex.com/edonv/SwiftUIContacts/documentation/swiftuicontacts).
## ContactPicker
`ContactPicker` supports four different selection modes and the mode is decided by which `init` you use:
- A single contact
- Use a `@Binding` of type `CNContact?` in the `init`
- Multiple contacts
- Use a `@Binding` of type `[CNContact]` in the `init`
- A single property of a contact
- Use a `@Binding` of type `CNContactProperty?` in the `init`
- A single property from multiple contacts
- Use a `@Binding` of type `[CNContactProperty]` in the `init`
```swift
.sheet(isPresented: $showSheet) {
ContactPicker(selection: $selectedProperty,
displayedPropertyKeys: [.phoneNumbersKey]
)
}
```