---
title: "setArray(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmutablearray/setarray(_:)"
---

# setArray(_:)

Sets the receiving array’s elements to those in another given array.

## Declaration

```swift
func setArray(_ otherArray: [Any])
```

## Parameters

- `otherArray`: The array of objects with which to replace the receiving array’s content.

## See Also

### Related Documentation

- [insert(_:at:)](foundation/nsmutablearray/insert(_:at:)-5dbx5.md)
- [addObjects(from:)](foundation/nsmutablearray/addobjects(from:).md)

### Replacing Objects

- [replaceObject(at:with:)](foundation/nsmutablearray/replaceobject(at:with:).md)
- [replaceObjects(at:with:)](foundation/nsmutablearray/replaceobjects(at:with:).md)
- [replaceObjects(in:withObjectsFrom:range:)](foundation/nsmutablearray/replaceobjects(in:withobjectsfrom:range:).md)
- [replaceObjects(in:withObjectsFrom:)](foundation/nsmutablearray/replaceobjects(in:withobjectsfrom:).md)
