Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Features: ability to filter contacts + ability to set the maximum number of contacts to pick #54

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ranhsd
Copy link

@ranhsd ranhsd commented Aug 8, 2017

This pull request contain 2 new features for this library:

  1. Ability to filter contacts -
    since the default CNContactStore does not allow to create custom NSPredicate via CNContactFetchRequest i've added a new delegate method that will be called in each iteration inside the enumerateContacts in this delegate method the user can decide if the given contact should be added or not to the results. In order to use you simply override the:

func epContactPicker(_: EPContactsPicker, shouldAddContact contact: EPContact) -> Bool

method in the delegate and there write the code which determine if the contact should be added to the results or not. This method return a boolean if its true the contact will be added otherwise it will be ignored. By default all contact will be added to the result set.

  1. Set maximum number of picked contacts - I've introduce 2 new init methods which allows you to set the max number of contact that the user can select (works in multi selection mode only).

setting this value can be done in one of the following init methods:

convenience public init(delegate: EPPickerDelegate?, multiSelection : Bool, multiSelectionLimit: UInt)

convenience public init(delegate: EPPickerDelegate?, multiSelection : Bool, multiSelectionLimit: UInt, subtitleCellType: SubtitleCellValue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant