---
title: "moveObjects(at:to:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmutableorderedset/moveobjects(at:to:)"
---

# moveObjects(at:to:)

Moves the objects at the specified indexes to the new location.

## Declaration

```swift
func moveObjects(at indexes: IndexSet, to idx: Int)
```

## Parameters

- `indexes`: The indexes of the objects to move.
- `idx`: The index in the mutable ordered set at which to insert the objects. The objects being moved are first removed from the set, then this index is used to find the location at which to insert the moved objects.

## Discussion

Discussion For example, the following code results in the contents of mySet being equal to ["a", "c", "b", "d", "e"]:

## 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(at:with:)](foundation/nsmutableorderedset/replaceobjects(at:with:).md)
- [replaceObjects(in:with:count:)](foundation/nsmutableorderedset/replaceobjects(in:with:count:).md)
- [setObject(_:at:)](foundation/nsmutableorderedset/setobject(_:at:).md)
