JFContactsPicker
A contacts picker component using Apple's Contacts framework.
This library was originally forked from EPContactsPicker, which is no longer maintained.
Preview
Installation
CocoaPods
JFContactsPicker is available on CocoaPods. Just add the following to your project Podfile:
pod 'JFContactsPicker', '~> 1.0'
Manual Installation
Just drag and drop the Source
folder into your project
Requirements
- iOS9+
- Swift 3.0
- ARC
For manual installation you may need to add these frameworks in your Build Phases:
ContactsUI.framework
and Contacts.framework
.
Features
JFContacts Picker provides all common functionality and customization features:
[x] Single selection and multi-selection options. [x] Search Contacts [x] Configure the contact data to be shown. (Phone Number, Email, Birthday, or Organization) [x] Section indexes to easily navigate through the contacts. [x] Shows initials when image is not available. [x] Contact object to get the properties of the contacts
If you would like additional support for additional customization features, please Create a New Issue.
Initialization
Initialize the picker by passing the delegate, multiselection option, and the secondary data type to be displayed (Phone Number, Email, Birthday, or Organization).
let contactPicker = ContactsPicker(delegate: self, multiSelection:false, subtitleCellType: .email)
let navigationController = UINavigationController(rootViewController: contactPicker)
self.present(navigationController, animated: true, completion: nil)
Delegates
ContactsPicker provides you four delegate methods for responding to the picker's events.
func contactPicker(_: ContactsPicker, didContactFetchFailed error : NSError)
func contactPicker(_: ContactsPicker, didCancel error : NSError)
func contactPicker(_: ContactsPicker, didSelectContact contact : Contact)
func contactPicker(_: ContactsPicker, didSelectMultipleContacts contacts : [Contact])
Contact Object
The Contact
object provides you the properties of a contact. This contains properties like displayName, initials, firstName, lastName, company, birthday, etc.
License
JFContactsPicker is available under the MIT license. See the LICENSE file for more info.