Class

CNContactViewController

A view controller that displays a new, unknown, or existing contact.

Declaration

iOS, Mac Catalyst
@interface CNContactViewController : UIViewController
macOS
@interface CNContactViewController : NSViewController

Overview

Present a CNContactViewController object when you want to display information about one of the user's contacts. At creation time, you specify the type of contact you want to display: new, unknown, or existing.

Topics

Creating the Contact Viewer

+ viewControllerForContact:

Initializes a view controller for an existing contact.

+ viewControllerForUnknownContact:

Initializes a view controller for an unknown contact.

+ viewControllerForNewContact:

Initializes a view controller for a new contact.

Handling Interactions with the Interface

delegate

The delegate to be notified.

CNContactViewControllerDelegate

Methods you use to respond to user interactions with a contact view controller.

Required Keys

+ descriptorForRequiredKeys

Returns the descriptor for all the keys that must be fetched on the contact before setting it on the view controller.

Displaying Contact Properties

contact

The contact being displayed.

alternateName

The name to use if the contact has no display name.

message

The message displayed under the name of the contact.

displayedPropertyKeys

The contact property keys to display.

Configuring the Contact's Relationships

parentGroup

The group in which to add a new contact.

parentContainer

The container in which to add a new contact.

Contact Store

contactStore

The contact store from which the contact was fetched or to which it will be saved.

Customizing Contact Card

allowsEditing

Determines whether the user can edit the contact’s information.

allowsActions

Determines whether to display buttons for actions such as sending a text message or initiating a FaceTime call.

shouldShowLinkedContacts

Determines whether to display data from contacts that are linked to the contact being displayed.

Highlighting a Property

- highlightPropertyWithKey:identifier:

Highlights the property of the contact being displayed.

Relationships