A specific characteristic of a service—for example, if a light is on or off, or to what temperature a thermostat is set.


class HMCharacteristic : NSObject


Information About a Characteristic

var uniqueIdentifier: UUID

A unique identifier for the characteristic.

var characteristicType: String

The type of the characteristic.

var service: HMService?

The service that contains this characteristic.

var properties: [String]

Array of properties that describe the characteristic.

var localizedDescription: String

The localized description of the characteristic.

var metadata: HMCharacteristicMetadata?

Metadata about the units and other properties of the characteristic.

Receiving Notifications

func enableNotification(Bool, completionHandler: (Error?) -> Void)

Enables/disables notifications or indications for the value of the characteristic.

var isNotificationEnabled: Bool

Returns whether the characteristic has been set to send notifications.

Managing Values

var value: Any?

The current value of the characteristic.

func readValue(completionHandler: (Error?) -> Void)

Reads the value for the characteristic.

func writeValue(Any?, completionHandler: (Error?) -> Void)

Modifies the value of the characteristic.

func updateAuthorizationData(Data?, completionHandler: (Error?) -> Void)

Sets/clears authorization data used when writing to the characteristic.


Characteristic Properties

Constants that represent the properties that characteristics can have.

Characteristic Types

Constants that define the characteristic types supported by the HomeKit Accessory Profile for HomeKit-based accessories.

Characteristic Values

Constants that define valid values for characteristic types supported by the HomeKit Accessory Profile for HomeKit-based accessories.


Inherits From

Conforms To

See Also

Service and Characteristic Setup

class HMService

A service provided by an accessory.

class HMServiceGroup

A collection of accessory services.

class HMCharacteristicMetadata

Metadata that further specifies a characteristic’s value and that may be useful for presentation purposes.