Contents

enableNotification(_:completionHandler:)

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

Declaration

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

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