Skip to content

Instantly share code, notes, and snippets.

View prrane's full-sized avatar

Prashant Rane prrane

View GitHub Profile
@prrane
prrane / ReadAddressBook.swift
Created September 4, 2014 05:34
Swift: Get contact emails from AddressBook
// based on : http://stackoverflow.com/questions/24752627/accessing-ios-address-book-with-swift-array-count-of-zero
// http://stackoverflow.com/questions/24752627/accessing-ios-address-book-with-swift-array-count-of-zero
class func extractABAddressBookRef(abRef: Unmanaged<ABAddressBookRef>!) -> ABAddressBookRef? {
if let ab = abRef {
return Unmanaged<NSObject>.fromOpaque(ab.toOpaque()).takeUnretainedValue()
}
return nil
}