<!--
{
  "availability" : [
    "DriverKit: -",
    "iOS: -",
    "iPadOS: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/OSSet/merge",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "DriverKit"
    ],
    "preciseIdentifier" : "c:@S@OSSet@F@merge#*1$@S@OSArray#"
  },
  "title" : "merge"
}
-->

# merge

Adds the contents of an OSet to the set.

```
bool merge(const OSArray *otherArray);
```

## Parameters

`otherArray`

The OSSet object containing the objects to be added.

## Return Value

`true` if any object from `set` are successfully added the receiver (or were already present), `false` otherwise.

## Discussion

This functions adds to the receiving set all objects from `set` that are not already in the receiving set. Objects added to the receiver are retained.

In releases prior to 10.7, this function would return `false` if an object from `set` was already present in the set, or if `set` was empty. This is no longer the case, so this function correctly returns `true` when the semantic of merging is met.

---

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)