Generic Class

CNLabeledValue

An immutable object that combines a contact property value with a label that describes that property.

Declaration

class CNLabeledValue<ValueType> : NSObject where ValueType : NSCopying, ValueType : NSSecureCoding

Overview

Labels describe the context for a given property. For example, the label for a phone number indicates whether it corresponds to the user's home, work, or iPhone number.

CNLabeledValue objects are thread-safe, and you may access their properties from any thread of your app.

Topics

Creating a Labeled Value

init(label: String?, value: ValueType)

Returns a new labeled value identifier initialized with the specified label and value.

Getting the Label and Value

var label: String?

The label for a contact property value.

var value: ValueType

A contact property value.

Setting Labels and Values

func settingLabel(String?) -> Self

Returns a labeled value object with an existing value and identifier.

func settingLabel(String?, value: ValueType) -> Self

Returns a labeled value object with the specified label and value with the existing identifier.

func settingValue(ValueType) -> Self

Returns a new value for an existing label and identifier.

Localizing the Label and Value

class func localizedString(forLabel: String) -> String

Returns a localized string for the specified label.

Getting the Unique Identifier

var identifier: String

A unique identifier for the labeled value object.

Getting Common Labels

let CNLabelHome: String

The label for identifying home information.

let CNLabelWork: String

The label for identifying work information.

let CNLabelOther: String

The label for identifying other information.

let CNLabelEmailiCloud: String

The label for identifying the contact's iCloud email information.

let CNLabelURLAddressHomePage: String

The label for identifying URL information.

let CNLabelDateAnniversary: String

The label for identifying the contact's anniversary date.

Getting Phone Number Labels

let CNLabelPhoneNumberMain: String

The label for identifying the contact's main phone number.

let CNLabelPhoneNumberiPhone: String

The label for identifying the contact's iPhone number.

let CNLabelPhoneNumberMobile: String

The label for identifying the contact's mobile phone number.

let CNLabelPhoneNumberPager: String

The label for identifying the contact's pager phone number.

let CNLabelPhoneNumberWorkFax: String

The label for identifying the contact's work fax phone number.

let CNLabelPhoneNumberHomeFax: String

The label for identifying the contact's home fax phone number.

let CNLabelPhoneNumberOtherFax: String

The label for identifying another fax phone number.

Getting Relationship Labels

let CNLabelContactRelationSpouse: String

The label for the contact's spouse.

let CNLabelContactRelationPartner: String

The label for the contact's partner.

let CNLabelContactRelationDaughter: String

The label for the contact's daughter.

let CNLabelContactRelationSon: String

The label for the contact's son.

let CNLabelContactRelationChild: String

The label for the contact's child.

let CNLabelContactRelationParent: String

The label for the contact's parent.

let CNLabelContactRelationFather: String

The label for the contact's father.

let CNLabelContactRelationMother: String

The label for the contact's mother.

let CNLabelContactRelationSister: String

The label for the contact's sister.

let CNLabelContactRelationBrother: String

The label for the contact's brother.

let CNLabelContactRelationFriend: String

The label for the contact's friend.

let CNLabelContactRelationManager: String

The label for the contact's manager.

let CNLabelContactRelationAssistant: String

The label for the contact's assistant.

Relationships

Inherits From

See Also

Generic Types

class CNContactProperty

An object that represents a property of a contact.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software