<!--
{
  "availability" : [
    "macOS: 10.7.0 - 13.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SecTransformSetDataAction(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SecTransformSetDataAction"
  },
  "title" : "SecTransformSetDataAction(_:_:_:)"
}
-->

# SecTransformSetDataAction(_:_:_:)

Changes the way a custom transform processes data.

```
func SecTransformSetDataAction(_ ref: SecTransformImplementationRef, _ action: CFString, _ newAction: @escaping SecTransformDataBlock) -> CFError?
```

## Parameters

`ref`

A [`SecTransformImplementationRef`](/documentation/Security/SecTransformImplementationRef) that is bound to an instance of a custom transform.

`action`

The action being overridden.

    Use  [`kSecTransformActionProcessData`](/documentation/Security/kSecTransformActionProcessData)     to change the way that input data is processed into the output data. The default behavior is to simply copy the input data to the output attribute. Changing this behavior is really a special case of a [`SecTransformSetAttributeAction(_:_:_:_:)`](/documentation/Security/SecTransformSetAttributeAction(_:_:_:_:))     action. Using [`kSecTransformActionProcessData`](/documentation/Security/kSecTransformActionProcessData)     as the     `action`     overwrites any previously set [`kSecTransformActionAttributeNotification`](/documentation/Security/kSecTransformActionAttributeNotification)     action.

    Use [`kSecTransformActionInternalizeExtraData`](/documentation/Security/kSecTransformActionInternalizeExtraData)     to change the way that custom externalized data is imported into the transform. The default behavior is to do nothing.

`newAction`

A [`SecTransformDataBlock`](/documentation/Security/SecTransformDataBlock) which implements the behavior.

    If the     `action`     parameter is [`kSecTransformActionProcessData`](/documentation/Security/kSecTransformActionProcessData)     then this block is called to process the input data into the output data. If the action parameter is [`kSecTransformActionInternalizeExtraData`](/documentation/Security/kSecTransformActionInternalizeExtraData)     then this block is called to input custom data into the transform.

## Return Value

An error on failure, or `NULL` on success. In Objective-C, call the <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease> function to free the error’s memory when you are done with it.

## Discussion

When the `action` parameter is [`kSecTransformActionProcessData`](/documentation/Security/kSecTransformActionProcessData), the `newAction` block changes the way that input data is processed to become the output data. When the `action` parameter is [`kSecTransformActionInternalizeExtraData`](/documentation/Security/kSecTransformActionInternalizeExtraData) it changes the way a custom transform reads in data to be imported into the transform.

You may call this function multiple times. The last call takes precedence.

---

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)