<!--
{
  "availability" : [
    "FxPlug: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "professional_video_applications",
  "identifier" : "/documentation/professional_video_applications/FxCustomParameterActionAPI_v4/startAction(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Professional Video Applications"
    ],
    "preciseIdentifier" : "c:objc(pl)FxCustomParameterActionAPI_v4(im)startAction:"
  },
  "title" : "startAction(_:)"
}
-->

# startAction(_:)

Prepares the host to access parameters.

```
func startAction(_ sender: Any!)
```

## Parameters

`sender`

The view class that implements this protocol. Typically passed as self.

## Discussion

OSC plug-ins (implementing [`FxOnScreenControl_v4`](/documentation/professional_video_applications/FxOnScreenControl_v4)) should not use [`startAction(_:)`](/documentation/professional_video_applications/FxCustomParameterActionAPI_v4/startAction(_:)) and [`endAction(_:)`](/documentation/professional_video_applications/FxCustomParameterActionAPI_v4/endAction(_:)), as the host is already aware that parameters are likely to change.

Starting with FxPlug 4, the [`startAction(_:)`](/documentation/professional_video_applications/FxCustomParameterActionAPI_v4/startAction(_:)) function is more heavyweight than in the past. Calling [`startAction(_:)`](/documentation/professional_video_applications/FxCustomParameterActionAPI_v4/startAction(_:)) will cause the host application to gather up the value of all parameters in the plug-in and send them to the XPC service. Any calls to the [`FxUndoAPI`](/documentation/professional_video_applications/FxUndoAPI), [`FxParameterSettingAPI_v6`](/documentation/professional_video_applications/FxParameterSettingAPI_v6), [`FxParameterRetrievalAPI_v7`](/documentation/professional_video_applications/FxParameterRetrievalAPI_v7), or [`FxKeyframeAPI_v3`](/documentation/professional_video_applications/FxKeyframeAPI_v3) will be queued up and sent to the host in bulk once you call [`endAction(_:)`](/documentation/professional_video_applications/FxCustomParameterActionAPI_v4/endAction(_:)). Therefore you should avoid making calls like this:

```swift
let customParameterActionAPI = _apiManager.api(for: FxCustomParameterActionAPI_v4.self) as? FxCustomParameterActionAPI_v4
customParameterActionAPI.startAction(_:self)
let undoAPI = _apiManager.api(for: FxUndoAPI.self) as? FxUndoAPI
undoAPI.startUndoGroup(_, name: "Change Parameter");
customParamActionAPI.endAction()
       
// … later in the same function…
customParameterActionAPI.startAction(_:self)
let paramSetAPI = _apiManager.api(for: FxParameterSettingAPI_v6.self) as? FxParameterSettingAPI_v6
paramSetAPI.setFloatValue(1.0, toParameter: 5, at: customParameterActionAPI.currentTime)
customParamActionAPI.endAction()
       
// … later in the same function…
customParameterActionAPI.startAction(_:self)
let undoAPI = _apiManager.api(for: FxUndoAPI.self) as? FxUndoAPI
undoAPI.endUndoGroup();
customParamActionAPI.endAction(_:self)
```

This code will not work properly. The calls to [`startAction(_:)`](/documentation/professional_video_applications/FxCustomParameterActionAPI_v4/startAction(_:)) and [`endAction(_:)`](/documentation/professional_video_applications/FxCustomParameterActionAPI_v4/endAction(_:)) in the first block will cause the host app to start an undo group without closing it in the same run loop. The calls to set the parameter will not be enclosed in an undo group and will be executed in a different run loop occurrence than the call to [`startUndoGroup(_:)`](/documentation/professional_video_applications/FxUndoAPI/startUndoGroup(_:)) in the host application. The call to end the undo group will occur in a third run loop in the host app and will be unbalanced.

Instead you should call [`startAction(_:)`](/documentation/professional_video_applications/FxCustomParameterActionAPI_v4/startAction(_:)) before all actions you want to perform, and call [`endAction(_:)`](/documentation/professional_video_applications/FxCustomParameterActionAPI_v4/endAction(_:)) after all actions have been completed, like this:

```swift
let customParameterActionAPI = _apiManager.api(for: FxCustomParameterActionAPI_v4.self) as? FxCustomParameterActionAPI_v4
customParameterActionAPI.startAction(_:self)
let undoAPI = _apiManager.api(for: FxUndoAPI.self) as? FxUndoAPI
undoAPI.startUndoGroup(_, name: "Change Parameter");

// … later in the same function…
let paramSetAPI = _apiManager.api(for: FxParameterSettingAPI_v6.self) as? FxParameterSettingAPI_v6
paramSetAPI.setFloatValue(1.0, toParameter: 5, at: customParameterActionAPI.currentTime)

// … later in the same function…
undoAPI.endUndoGroup();
customParamActionAPI.endAction(_:self)
```

This will work as intended and start a single undo group that contains the parameter change.

---

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)