Giter VIP home page Giter VIP logo

epcontactspicker's Introduction

EPContactsPicker

EPContactsPicker

Contacts picker component using new contacts framework by apple

Platform Swift 3 CocoaPods Compatible CI Status License Twitter: @HaveYouMetPrabu

Preview

Single Selection Multi Selection

Installation

CocoaPods

EPContactsPicker is available on CocoaPods. Just add the following to your project Podfile:

pod 'EPContactsPicker'

Manual Installation

Just drag and drop the EPContactsPicker folder into your project

Requirements

  • iOS9+
  • Swift 3.0
  • ARC

For manual installation you might have to add these frameworks in your Build Phases ContactsUI.framework and Contacts.framework.

Features

EPContacts Picker provides lot of features which lets you customize the picker

  1. Single selection and multiselection option
  2. Search Contacts
  3. Making the secondary data to show as requested(Phonenumbers, Emails, Birthday and Organisation)
  4. Section Indexes to easily navigate throught the contacts
  5. Showing initials when image is not available
  6. EPContact object to get the properties of the contacts

Initialization

Init the picker by passing delegate, multiselection option and the secondary data(Phone number, Email, brithday and Organisation) to be displayed

let contactPickerScene = EPContactsPicker(delegate: self, multiSelection:false, subtitleCellType: SubtitleCellValue.Email)
let navigationController = UINavigationController(rootViewController: contactPickerScene)
self.presentViewController(navigationController, animated: true, completion: nil)

Delegates

EPContactsPicker provides you four delegates for getting the callbacks on the picker

func epContactPicker(_: EPContactsPicker, didContactFetchFailed error : NSError)
func epContactPicker(_: EPContactsPicker, didCancel error : NSError)
func epContactPicker(_: EPContactsPicker, didSelectContact contact : EPContact)
func epContactPicker(_: EPContactsPicker, didSelectMultipleContacts contacts : [EPContact])

EPContact Object

EPContact object provides you the properties of a contact. This contains properties like displayname, initials, firstname, lastname, organisation, birthdayString etc

License

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

Contributors

@ipraba @Sorix

epcontactspicker's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

epcontactspicker's Issues

index crash

Hi,

When there is non-ascii index such as Chinese, the project will be crash.

I fixed this issue on my branch like this

[EPContactsPicker.swift]
line:280
//return EPGlobalConstants.Arrays.alphabets.indexOf(title)!
return sortedContactKeys.indexOf(title)!

UISearchController throws error in latest codes

2016-02-12 17:10:46.567 App[4688:181576] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x7fa72ae9c5c0>)
2016-02-12 17:10:46.689 App[4688:181576] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/santanu/Library/Developer/CoreSimulator/Devices/80481011-AC98-4530-974D-CBEB990F4C81/data/Containers/Bundle/Application/4D6FFFBE-709D-4C82-B339-5D6661112B56/App.app> (loaded)' with name 'EPContactCell''

I followed by above error after updating latest by pod.

I added the EPContactsPicker in suggested way only:

let contactScene = EPContactsPicker(delegate: self, multiSelection: true, subtitleCellType: SubtitleCellValue.Email)
let contactNavController = UINavigationController(rootViewController: contactScene)
self.presentViewController(contactNavController, animated: true, completion: nil)

Carthage

Can this be installed via Carthage (for use in an Objective-C app)?

Bundle resources aren't available when installed via CocoaPods

2016-06-30 10:55:17.239 RecCheck[14128:3479311] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: '...A611DD64B6C2/MyApp.app> (loaded)' with name 'EPContactCell''

Please update the podspec to expose the bundle, then update the EPContactsPicker class to load the bundle with the specified key. For more information: https://the-nerd.be/2015/08/07/load-assets-from-bundle-resources-in-cocoapods/

Terminating app due to uncaught exception 'CNPropertyNotFetchedException', reason: 'A property was not requested when contact was fetched.'

When I put
let contactPickerScene = EPContactsPicker(delegate: self, multiSelection:true, subtitleCellType: SubtitleCellValue.phoneNumber) let navigationController = UINavigationController(rootViewController: contactPickerScene) self.present(navigationController, animated: true, completion: nil)
I got this
Terminating app due to uncaught exception 'CNPropertyNotFetchedException', reason: 'A property was not requested when contact was fetched.'
How to fix this?

Search

search by phone number (searchbar) ?

addSubView() not works expectedly

Instead of using in an UINavigationController I tried to add it's view to an UIViewController class:

let contactScene = EPContactsPicker(delegate: self, multiSelection: true, subtitleCellType: SubtitleCellValue.Phonenumer)
self.view.addSubview(contactScene.view)

This shown up the EPContactsPicker effectively but when tap on any entry, the entries disappears leaving only grid lines. Am I supposed to add EPContactsPicker in above way, or what I need to do differently?

Using the version before the swift 3 one

Attempting to load the view of a view controller while it is deallocating

"Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x100817850>)
fatal error: unexpectedly found nil while unwrapping an Optional value"

and then it crashes here:
EPcontact.swift - phoneNumbers.append((phone.stringValue,phoneNumber.label!))
EPcontactpicker.swift- contact = EPContact(contact: contactsForSection[indexPath.row])

How can i send the table view value to another view controller when i try throw they give exception

override open func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    
    
    if segue.identifier == kTaskViewControllerSegueIdentifier {
        
        let taskViewController = segue.destination as? Discountpopup
        
        if let indexPath = self.tableView.indexPathForSelectedRow{
            
            if resultSearchController.isActive && resultSearchController.searchBar.text != ""{
                let segueData : EPContact
                
                segueData = selectedContacts[indexPath.row]
                
                taskViewController?.contact = segueData
            }
            else if resultSearchController.isActive == false{
                
               
                
                let segueData : CNContact
                
                segueData = filteredContacts[indexPath.row]
                
                taskViewController?.contacts = segueData
                
                
            }
        }
        else {
            
        }
    }
    
}

Contact Selection when Searching

If you search for a contact and select it there is no way to exit the searching and keep the contact in view. It is hard to tell if Selection is kept, maybe showing Selected users would help. Similar to how EvContactPicker does it.

  1. Load Example
  2. Type in a name in search
  3. Select the contact
  4. Should be able to exit search but Cancel

One solution is do not hide the top navigation when selecting (allowing user to push Done)

Multi Selection

Multi selection doesn’t work properly. The tick marks on the cells doesn’t show up properly. For example if you select two contacts in multiselection, the tick marks are displayed on the other cells as well.

Ability to import from Groups

Would be nice if user could select either from a Contacts Group, or the whole Group, rather than selecting individually from All Contacts.

Swift 2.3 tag

Please add tag 1.0.8 to the commit d9367fb, so users may use your framework with Swift 2.3 via that line in podfile:

pod 'EPContactsPicker', '~> 1.0.8'

In that commit I've already added version 1.0.8 to a podspec.

Use cocoapods

Would be very nice if people could use this with cocoapods

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.