Initializer

init(type:value:)

Creates a mutable descriptor with a specified value.

Declaration

init(type UUID: CBUUID, value: Any?)

Parameters

UUID

A 128-bit UUID that identifies the characteristic. You must use only one of the two currently supported descriptor types: CBUUIDCharacteristicUserDescriptionString or CBUUIDCharacteristicFormatString. For more details about these descriptor types, see CBUUID.

value

The descriptor value to cache. You must provide a non-nil value. Once published, you can’t update the value dynamically.

Return Value

A newly initialized mutable descriptor.

Discussion

The value type of value depends on the type of descriptor:

If you want to create a local characteristic format descriptor, the descriptor’s value must conform to the attribute value of the characteristic format descriptor as defined in the Bluetooth 4.0 specification, Volume 3, Part G, Section 3.3.3.5.

See Also