---
title: "sort(by:ascending:)"
framework: musickit
role: symbol
role_heading: Instance Method
path: "musickit/musiclibraryrequest/sort(by:ascending:)"
---

# sort(by:ascending:)

Sorts items by a specified property.

## Declaration

```swift
mutating func sort<Value>(by keyPath: KeyPath<MusicItemType.LibrarySortProperties, Value>, ascending: Bool)
```
