<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/SortDescriptor",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation14SortDescriptorV"
  },
  "title" : "SortDescriptor"
}
-->

# SortDescriptor

A serializable description of how to sort numerics and strings.

```
struct SortDescriptor<Compared>
```

## Topics

### Creating Sort Descriptors

[`init(_:comparing:)`](/documentation/Foundation/SortDescriptor/init(_:comparing:))

Creates a sort descriptor using a sort descriptor and a type that you specify.

### Using Sort Descriptors

### Inspecting Sort Descriptors

[`order`](/documentation/Foundation/SortDescriptor/order)

The sort order that the sort descriptor uses to compare.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)
