Reputation: 9419
I have a User
model item, and I want to use this User
information to create a contact that can be shared through a UIActivityController
. This is currently not possible because the properties of CNContact
s are read-only:
if let name = user?.firstName {
contact.givenName = name
}
if let lastName = user?.lastName {
contact.familyName = lastName
}
if let companyRole = user?.companyRole {
contact.jobTitle = companyRole
}
if let company = user?.company {
contact.organizationName = company
}
Is it possible to create a contact? I don't see any constructs/initializers that allow me to create one.
Upvotes: 0
Views: 91
Reputation: 58149
You should work with a CNMutableContact
instead of a CNContact
. That way, the properties will be modifiable.
Upvotes: 1