<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSMutableOrderedSet/insert(_:at:)-3ncnm",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMutableOrderedSet(im)insertObjects:atIndexes:"
  },
  "title" : "insert(_:at:)"
}
-->

# insert(_:at:)

Inserts the objects in the array at the specified indexes.

```
func insert(_ objects: [Any], at indexes: IndexSet)
```

## Parameters

`objects`

An array of objects to insert into the mutable ordered set.

`indexes`

The indexes at which the objects in objects should be inserted. The count of locations in indexes must equal the count of objects.

## Discussion

Each object in objects is inserted into the receiving mutable ordered set in turn at the corresponding location specified in indexes after earlier insertions have been made.

---

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)