I am attempting to retrieve the names and phone number(s) of all contacts and put them into arrays with Swift in iOS. I have made it this far:
Here is how you do it in swift 4
func contactPicker(_ picker: CNContactPickerViewController, didSelect contactProperty: CNContactProperty) { if let phoneNo = contactProperty.value as? CNPhoneNumber{ txtPhone.text = phoneNo.stringValue }else{ txtPhone.text="" } }