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:
Keeping things simple:
let phoneNumbers: [String] = contact.phoneNumbers.compactMap { (phoneNumber: CNLabeledValue) in guard let number = phoneNumber.value.value(forKey: "digits") as? String else { return nil } return number }