Contents

attachedMode(of:)

Returns the propagation mode of a stored attachment you identify with a key path to a key definition that supplies a default, without retrieving it.

Declaration

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

Parameters

  • keyPath:

    A key path to a key definition that supplies a default value.

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.

Because this kind of key supplies a default, reading it as a property always produces a value, whether or not the container holds an attachment for it. This method returns nil in the second case, which makes it the way to tell a stored value from a defaulted one.