Function

SecTransformSetAttributeAction(_:_:_:_:)

Requests a callback when an attribute is set.

Declaration

func SecTransformSetAttributeAction(_ ref: SecTransformImplementationRef, _ action: CFString, _ attribute: SecTransformStringOrAttribute?, _ newAction: @escaping SecTransformAttributeActionBlock) -> CFError?

Parameters

ref

A SecTransformImplementationRef that is bound to an instance of a custom transform.

action

The behavior to be set.

Use kSecTransformActionAttributeNotification to add a block that is called when an attribute is set. If the name is NULL, then the supplied block is called for all set attributes except for ones that have a specific block as a handler.

Use kSecTransformActionAttributeValidation to add a block that is called to validate the input to an attribute.

attribute

The name of the attribute that will be handled. An attribute reference may also be given here. A NULL value indicates that the supplied action is for all attributes.

newAction

A SecTransformAttributeActionBlock which implements the behavior.

Return Value

An error on failure, or nil on success.

Discussion

The kSecTransformActionProcessData action used with the SecTransformSetDataAction(_:_:_:) function is a special case of a SecTransformSetAttributeAction(_:_:_:_:) action. If this is called on the input attribute then it will overwrite any kSecTransformActionProcessData action.

You may call this function multiple times for either a named attribute or for all attributes when the attribute parameter is NULL. The last call takes precedence.

See Also

Actions

typealias SecTransformActionBlock

A block that overrides the default behavior of a custom transform.

typealias SecTransformAttributeActionBlock

A block used to override the default attribute handling for when an attribute is set.

typealias SecTransformDataBlock

A block used to override the default data handling for a transform.

Actions

Use actions to trigger particular behaviors.