Protocol

HMAccessoryDelegate

A set of methods that defines the communication method for state updates from accessories to their delegates.

Overview

Set a delegate on an accessory and implement methods in this protocol for updates you’re interested in observing to keep your app’s UI in sync with changes to HomeKit’s internal state.

HomeKit invokes delegate methods to notify your app of changes to the state of the home network. In general, if your app invokes a HomeKit method with a completion handler parameter and the method is successful, the associated delegate message is sent to other HomeKit apps running on the same or remote iOS devices. If your app initiates the change, the delegate message is not sent to your app, so you should add code to both the completion handler and the associated delegate method to reload data and update views as needed. To learn more about how HomeKit uses the delegation design pattern, read About HomeKit Delegation Methods.

Topics

Observing Accessories

func accessoryDidUpdateName(HMAccessory)

Informs the delegate when the name of the accessory is updated.

func accessoryDidUpdateReachability(HMAccessory)

Informs the delegate when the reachability of the accessory changes.

func accessoryDidUpdateServices(HMAccessory)

Informs the delegate when the services on the accessory have been updated.

func accessory(HMAccessory, didUpdateNameFor: HMService)

Informs the delegate when the name of a service is updated.

func accessory(HMAccessory, service: HMService, didUpdateValueFor: HMCharacteristic)

Informs the delegate of a change in value of a characteristic.

func accessory(HMAccessory, didUpdateAssociatedServiceTypeFor: HMService)

Informs the delegate when the associated service type of a service is modified.

Relationships

Inherits From

See Also

Discovery and Basic Setup

class HMAccessoryBrowser

A network browser used to discover new accessories.

protocol HMAccessoryBrowserDelegate

A set of methods used to notify an accessory browser delegate of new accessories.

class HMAccessory

A home automation accessory in the home, such as a garage door opener or a thermostat.

class HMAccessoryProfile

A profile implemented by an accessory.

class HMAccessoryCategory

The primary category for a HomeKit accessory.

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