youjinp / SwiftUIKit

A collection of missing SwiftUI components
MIT License
278 stars 32 forks source link

onSelectContacts - searchbar #8

Closed darshil closed 4 years ago

darshil commented 4 years ago

Is it possible to show the search bar for multiple contacts selection?

youjinp commented 4 years ago

Unfortunately not, search and multiple selection are mutually exclusive for CNContactPickerViewController.

You'll have to implement your own if you want them both together.

darshil commented 4 years ago

Do you know if it's possible to implement this library in SwiftUI? https://github.com/dragosrobertn/KNContactsPicker

It has the ability to do multi-select and search

youjinp commented 4 years ago

The problem I have with that is that it requires Privacy - Contacts Usage Description in the info plist, and users are required to explicitly allow access to their contact list.

Whereas using the built in CNContactPickerViewController doesn't require any permission.

youjinp commented 4 years ago

With that said, most things built using UIKit can be brought into SwiftUI by simply using UIViewControllerRepresentable. Hope that helps!