AddressBookKit 0.1.2

AddressBookKit 0.1.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Feb 2016
SPMSupports SPM

Maintained by Kenneth Tsang.



  • By
  • Kenneth Tsang

AddressBookKit

Requirements

iOS 8.0 or above

Installation

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

pod "AddressBookKit"

or

Copy AddressBookKit.swift and AddressBookDataType.swift into your project.

Usage

Ask for Contacts permission

AddressBookKit.requestPermission { [weak self] (success) -> Void in
    if success {
        // Success, read address book here...
        // Example:
        let phoneNumbers = AddressBookKit.plainContacts(.PhoneNumber)
    } else {
        // No Permission
    }
}

AddressBookKit.plainContacts() will returns an array of PlainContact. Example:

let phoneNumbers = AddressBookKit.plainContacts(.PhoneNumber)
let emails = AddressBookKit.plainContacts(.Email)

AddressBookKit.groupedContacts() will returns an array of GroupedContact. Example:

let phoneNumbers = AddressBookKit.groupedContacts([.PhoneNumber])
let emails = AddressBookKit.groupedContacts([.Email])
let phonesAndEmails = AddressBookKit.groupedContacts([.PhoneNumber, .Email])

What is PlainContact?

Varible Type Description
firstName String? First Name
middleName String? Middle Name
lastName String? Last Name
fullName String Full Name
value [String] A String representing phone number or email

What is GroupedContact?

Varible Type Description
firstName String? First Name
middleName String? Middle Name
lastName String? Last Name
fullName String Full Name
phoneNumbers [String] An array of phone numbers in this contact
emails [String] An array of Emails in this contact

Author

Kenneth Tsang, [email protected]

License

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