I'm currently doing this to get an array of strings with users phone numbers :
if let phoneNumbers = contacts.map({$0.phoneNumber}) as? [String] { }
Contact Object:
class Contact {
var name: String!
var phoneNumber: String!
}
How can instead of getting an array of string with the phone numbers get an array of strings with each of the contacts name and phone number? I want to include both values in the string array instead of just the phone number.
Thanks
Edit:
Current output is something like this ["3453534534", "34534535345"] where those are phone numbers.
The output that I hope to achieve is something like this ["john" : "12312312", "robert" : "32423423423"]