Latest 0.1.2
Homepage https://github.com/KennethTsang/AddressBookKit
License MIT
Platforms ios 8.0, requires ARC
Frameworks AddressBook
Authors

Version
License
Platform
Language

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.

Latest podspec

{
    "name": "AddressBookKit",
    "version": "0.1.2",
    "summary": "The most simple way to get device's phone book in Swift.",
    "description": "The most simple way to get device's phone book in Swift. Please see example project.",
    "homepage": "https://github.com/KennethTsang/AddressBookKit",
    "license": "MIT",
    "authors": {
        "Kenneth Tsang": "[email protected]"
    },
    "source": {
        "git": "https://github.com/KennethTsang/AddressBookKit.git",
        "tag": "0.1.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "AddressBookKit": [
            "Pod/Assets/*.png"
        ]
    },
    "frameworks": "AddressBook"
}

Pin It on Pinterest

Share This