Skip to content

Instantly share code, notes, and snippets.

@ekurutepe
Last active August 29, 2015 14:13
Show Gist options
  • Save ekurutepe/7994d725af6975f1d035 to your computer and use it in GitHub Desktop.
Save ekurutepe/7994d725af6975f1d035 to your computer and use it in GitHub Desktop.
How to extract an email out of an ABRecord using Swift…
var unmanagedEmails = ABRecordCopyValue(person, property);
let emails: ABMultiValueRef =
Unmanaged.fromOpaque(unmanagedEmails.toOpaque()).takeUnretainedValue() as NSObject as ABMultiValueRef
let index = ABMultiValueGetIndexForIdentifier(emails, identifier)
var unmanagedEmail = ABMultiValueCopyValueAtIndex(emails, index);
let email: String = Unmanaged.fromOpaque(unmanagedEmail.toOpaque()).takeUnretainedValue() as NSObject as String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment