Instance Method

enableNotification(_:completionHandler:)

Enables or disables notifications for changes in the value of the characteristic.

Declaration

func enableNotification(_ enable: Bool, completionHandler completion: @escaping (Error?) -> Void)

Parameters

enable

true to enable notifications, false to disable notifications.

completion

The block executed after the request is processed.

error

nil on success; otherwise, error object indicating the reason for failure.

Discussion

HomeKit delivers notifications to the accessory delegate using the accessory(_:service:didUpdateValueFor:) method.

See Also

Receiving Change Notifications

var isNotificationEnabled: Bool

A Boolean indicating whether the characteristic has been set to send notifications.