---
title: "replaceObjects(at:with:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmutableorderedset/replaceobjects(at:with:)"
---

# replaceObjects(at:with:)

Replaces the objects at the specified indexes with the new objects.

## Declaration

```swift
func replaceObjects(at indexes: IndexSet, with objects: [Any])
```

## Parameters

- `indexes`: The indexes of the objects to be replaced.
- `objects`: The objects with which to replace the objects in the receiving mutable ordered set at the indexes specified by indexes. The count of locations in indexes must equal the count of objects.

## Discussion

Discussion The indexes in indexes are used in the same order as the objects in objects.

## See Also

### Adding, Removing, and Reordering Entries

- [add(_:)](foundation/nsmutableorderedset/add(_:).md)
- [add(_:count:)](foundation/nsmutableorderedset/add(_:count:).md)
- [addObjects(from:)](foundation/nsmutableorderedset/addobjects(from:).md)
- [insert(_:at:)](foundation/nsmutableorderedset/insert(_:at:)-7qg51.md)
- [insert(_:at:)](foundation/nsmutableorderedset/insert(_:at:)-3ncnm.md)
- [remove(_:)](foundation/nsmutableorderedset/remove(_:).md)
- [removeObject(at:)](foundation/nsmutableorderedset/removeobject(at:).md)
- [removeObjects(at:)](foundation/nsmutableorderedset/removeobjects(at:).md)
- [removeObjects(in:)](foundation/nsmutableorderedset/removeobjects(in:)-8h2kh.md)
- [removeObjects(in:)](foundation/nsmutableorderedset/removeobjects(in:)-9jkis.md)
- [removeAllObjects()](foundation/nsmutableorderedset/removeallobjects().md)
- [replaceObject(at:with:)](foundation/nsmutableorderedset/replaceobject(at:with:).md)
- [replaceObjects(in:with:count:)](foundation/nsmutableorderedset/replaceobjects(in:with:count:).md)
- [setObject(_:at:)](foundation/nsmutableorderedset/setobject(_:at:).md)
- [moveObjects(at:to:)](foundation/nsmutableorderedset/moveobjects(at:to:).md)
