Contents

attachedMode(of:)

Returns the propagation mode of a stored attachment you identify with a key path to a key definition, without retrieving the value.

Declaration

func attachedMode(of keyPath: KeyPath<Keys.Type, CVAttachmentKeyDefinition<some CVAttachmentModePreference, some CVAttachmentValueRepresentable>>) -> CVAttachmentMode?

Parameters

  • keyPath:

    A key path to a key definition declared on the key definitions type.

Return Value

The propagation mode of the attachment, or nil if the key isn’t attached.

Discussion

Use this method to check for the presence of a specific key without converting its value.

The mode this method returns is the mode the attachment actually carries, which can differ from the preferred mode the key definition declares. Code that sets an attachment through the key’s raw value can ignore that preference.