---
title: "sortedArray(using:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsarray/sortedarray(using:)-82wi1"
---

# sortedArray(using:)

Returns a copy of the receiving array sorted as specified by a given array of sort descriptors.

## Declaration

```swift
func sortedArray(using sortDescriptors: [NSSortDescriptor]) -> [Any]
```

## Parameters

- `sortDescriptors`: An array of NSSortDescriptor objects.

## Return Value

Return Value A copy of the receiving array sorted as specified by sortDescriptors.

## Discussion

Discussion The first descriptor specifies the primary key path to be used in sorting the receiving array’s contents. Any subsequent descriptors are used to further refine sorting of objects with duplicate values. See NSSortDescriptor for additional information.

## See Also

### Sorting

- [sortedArrayHint](foundation/nsarray/sortedarrayhint.md)
- [sortedArray(_:context:)](foundation/nsarray/sortedarray(_:context:).md)
- [sortedArray(_:context:hint:)](foundation/nsarray/sortedarray(_:context:hint:).md)
- [sortedArray(using:)](foundation/nsarray/sortedarray(using:)-9nhh9.md)
- [sortedArray(comparator:)](foundation/nsarray/sortedarray(comparator:).md)
- [sortedArray(options:usingComparator:)](foundation/nsarray/sortedarray(options:usingcomparator:).md)
- [Comparator](foundation/comparator.md)
