<!--
{
  "availability" : [
    "macOS: 10.7.0 - 13.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SecTransformActionBlock",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@T@SecTransformActionBlock"
  },
  "title" : "SecTransformActionBlock"
}
-->

# SecTransformActionBlock

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

```
typealias SecTransformActionBlock = () -> Unmanaged<CFTypeRef>?
```

## Return Value

A dictionary of the custom items to be exported if this block is used to override the [`kSecTransformActionExternalizeExtraData`](/documentation/Security/kSecTransformActionExternalizeExtraData) action or  `NULL` for any other action. Alternatively, the block returns a <doc://com.apple.documentation/documentation/CoreFoundation/CFError> object if an error occurs.

## Discussion

A  block of this type is used to override the default behavior of a custom transform. This block is associated with the SecTransformOverrideTransformAction block.

The behaviors that can be overridden are:

- [`kSecTransformActionCanExecute`](/documentation/Security/kSecTransformActionCanExecute) - Determine if the transform has all of the data needed to run.
- [`kSecTransformActionStartingExecution`](/documentation/Security/kSecTransformActionStartingExecution) - Called just before running ProcessData.
- [`kSecTransformActionFinalize`](/documentation/Security/kSecTransformActionFinalize) - Called just before deleting the custom transform.
- [`kSecTransformActionExternalizeExtraData`](/documentation/Security/kSecTransformActionExternalizeExtraData) - Called to allow for writing out custom data to be exported.

For example:

```objc
SecTransformImplementationRef ref;
CFErrorRef error = NULL;
 
error = SecTransformSetTransformAction(ref, kSecTransformActionStartingExecution, ^{
    // Initialize any data needed before running
    CFErrorRef result = DoMyInitialization();
    return result;});
 
SecTransformTransformActionBlock actionBlock =
^{
    // Clean up any existing data before running
    CFErrorRef result = DoMyFinalization();
    return result;};
 
error = SecTransformSetTransformAction(ref, kSecTransformActionFinalize,actionBlock);
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)