<!--
{
  "availability" : [
    "driverkit: 19.0.0 -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "HIDDriverKit",
  "identifier" : "/documentation/HIDDriverKit/IOHIDInterface/commitElements",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HIDDriverKit"
    ],
    "preciseIdentifier" : "c:@S@IOHIDInterface@F@commitElements#*$@S@OSArray#$@EA@IOHIDElementCommitDirection#"
  },
  "title" : "commitElements"
}
-->

# commitElements

Gets or sets the contents of the interface’s stored elements.

```
virtual kern_return_t commitElements(OSArray *elements, IOHIDElementCommitDirection direction);
```

## Parameters

`elements`

An array of [`IOHIDElement`](/documentation/HIDDriverKit/IOHIDElement) objects.

`direction`

The direction in which to commit changes. Specify [`kIOHIDElementCommitDirectionIn`](/documentation/HIDDriverKit/IOHIDElementCommitDirection/kIOHIDElementCommitDirectionIn) to read the element data from the device. Specify [`kIOHIDElementCommitDirectionOut`](/documentation/HIDDriverKit/IOHIDElementCommitDirection/kIOHIDElementCommitDirectionOut) to write the element data to the device.

## Return Value

<doc://com.apple.documentation/documentation/DriverKit/kIOReturnSuccess> on success, or another value if an error occurs. See <doc://com.apple.documentation/documentation/DriverKit/error-codes>.

---

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)