<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSOrderedCollectionDifference/init(insert:insertedObjects:remove:removedObjects:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSOrderedCollectionDifference(im)initWithInsertIndexes:insertedObjects:removeIndexes:removedObjects:"
  },
  "title" : "init(insert:insertedObjects:remove:removedObjects:)"
}
-->

# init(insert:insertedObjects:remove:removedObjects:)

Creates an ordered collection difference from arrays of inserted and removed objects with corresponding sets of indices.

```
convenience init(insert inserts: IndexSet, insertedObjects: [Any]?, remove removes: IndexSet, removedObjects: [Any]?)
```

## Parameters

`inserts`

An index set that represents the index values to associate with the objects in the provided array of inserted objects.

`insertedObjects`

An array of objects the ordered collection difference will insert.

`removes`

An index set that represents the index values to associate with the objects in the provided array of removed objects.

`removedObjects`

An array of objects the ordered collection difference will remove.

---

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)