---
title: "SecTransformSetDataAction(_:_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/sectransformsetdataaction(_:_:_:)"
---

# SecTransformSetDataAction(_:_:_:)

Changes the way a custom transform processes data.

## Declaration

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

## Parameters

- `ref`: A doc://com.apple.security/documentation/Security/SecTransformImplementationRef that is bound to an instance of a custom transform.
- `action`: The action being overridden. Use doc://com.apple.security/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 doc://com.apple.security/documentation/Security/SecTransformSetAttributeAction(_:_:_:_:) action. Using doc://com.apple.security/documentation/Security/kSecTransformActionProcessData as the action overwrites any previously set doc://com.apple.security/documentation/Security/kSecTransformActionAttributeNotification action. Use doc://com.apple.security/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 doc://com.apple.security/documentation/Security/SecTransformDataBlock which implements the behavior. If the action parameter is doc://com.apple.security/documentation/Security/kSecTransformActionProcessData then this block is called to process the input data into the output data. If the action parameter is doc://com.apple.security/documentation/Security/kSecTransformActionInternalizeExtraData then this block is called to input custom data into the transform.

## Return Value

Return Value An error on failure, or NULL on success. In Objective-C, call the CFRelease function to free the error’s memory when you are done with it.

## Discussion

Discussion When the action parameter is kSecTransformActionProcessData, the newAction block changes the way that input data is processed to become the output data. When the action parameter is 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.
