---
title: "init(insert:insertedObjects:remove:removedObjects:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsorderedcollectiondifference/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.

## Declaration

```swift
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.

## See Also

### Creating a Collection Difference Object

- [init(changes:)](foundation/nsorderedcollectiondifference/init(changes:).md)
- [init(insert:insertedObjects:remove:removedObjects:additionalChanges:)](foundation/nsorderedcollectiondifference/init(insert:insertedobjects:remove:removedobjects:additionalchanges:).md)
