Code Monkey home page Code Monkey logo

veecontactpicker's Introduction

VeeContactPicker

CI Status Version License Platform

VeeContactPicker Example

VeeContactPicker is an Objective-C replacement of the buggy ABPeoplePickerNavigationController: a ViewController for selecting contacts from the address book.

Features

  • ๐Ÿƒ๐Ÿฟ It loads the contacts very fast! Note that the official ABPeoplePickerNavigationController is really slow: see this thread)
  • ๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ง You can select multiple contacts! ๐ŸŽ‰๐ŸŽ‰ New from v1 ๐ŸŽ‰๐ŸŽ‰
  • ๐Ÿ”ต Contacts' images and coloured placeholders
  • ๐Ÿ” Search for your contacts! Also by email address or phone number.
  • ๐Ÿ›‚ Choose the contacts that you want to show in the picker (e.g only contacts with a valid email address)
  • ๐Ÿคก Easy customizable appearance
  • โœ… Good test coverage

How to use it - Basic

Add contact usage key to project info.plist file :

<key>NSContactsUsageDescription</key> 
<string>This app requires contacts access to function properly.</string> 

Import the ViewController:

# import "VeeContactPickerViewController.h"

Initialize it and set the delegate:

VeeContactPickerViewController *veeContactPickerViewController = [[VeeContactPickerViewController alloc] initWithDefaultConfiguration];
veeContactPickerViewController.contactPickerDelegate = self;
//do you want to select multiple contacts? veeContactPickerViewController.multipleSelection = YES;
[self presentViewController:veeContactPickerViewController animated:YES completion:nil];

Implement the delegate:

- (void)didSelectContact:(id<VeeContactProt>)veeContact
{
    //veeContact was selected
}

- (void)didSelectContacts:(NSArray<id<VeeContactProt>> *)veeContacts
{
    //veeContact were selected
}

- (void)didCancelContactSelection
{
  //No contact was selected
}

- (void)didFailToAccessAddressBook
{
  //Show an error?
}

That's all folks!

How to use it - Details

You can customize some properties of the picker by changing the VeeContactPickerOptions object and pass it to the initializer:

- (instancetype)initWithOptions:(VeeContactPickerOptions*)veeContactPickerOptions;

For example, if you don't like the contacts' initials images as the placeholder, you can set your own placeholder image:

VeeContactPickerOptions *veeContactPickerOptions = [VeeContactPickerOptions alloc] initWithDefaultOptions];
veeContactPickerOptions.showInitialsPlaceholder = NO;
veeContactPickerOptions.contactThumbnailImagePlaceholder = [UIImage imageNamed:@"your_placeholder"];
//...
VeeContactPickerViewController *veeContactPickerViewController = [[VeeContactPickerViewController alloc] initWithOptions:veeContactPickerOptions];
//...

Contact's image placeholder are provided by AGCInitials. You can customize the color palette if you want, see the README of AGCInitials.

  • If you want to change or localize the strings shown by the picker, look at this property:
veeContactPickerOptions.veeContactPickerStrings
  • If you want to choose which contacts to show, you can initialize the picker using:
- (instancetype)initWithVeeContacts:(NSArray<id<VeeContactProt>>*)veeContacts;

Picker Appearance:

You can customize the appearance of the contact picker by manipulating the object VeeContactPickerAppearanceConstants, before loading the picker.

For example:

[[VeeContactPickerAppearanceConstants sharedInstance] setNavigationBarTintColor:[UIColor purpleColor]];
[[VeeContactPickerAppearanceConstants sharedInstance] setNavigationBarTranslucent:NO];
[[VeeContactPickerAppearanceConstants sharedInstance] setContactCellPrimaryLabelFont:[UIFont yourFont]];
//...
[self presentViewController:veeContactPickerViewController animated:YES completion:nil];

Run the example

To run the example project, clone the repo, and run pod install from the Example directory first.

Or you can even try the example online with Appetize.

Requirements

  • iOS 8+

Installation

VeeContactPicker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "VeeContactPicker"

Author

Code Atlas SRL [email protected] Andrea Cipriani [email protected] - Main developer

License

VeeContactPicker is available under the MIT license. See the LICENSE file for more info.

App Store

VeeContactPicker is already used in the App Store for our app Veer Contacts Widget; if you appreciate our work, you can download the app for free! ๐Ÿค—

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.