---
title: "sortSections(by:ascending:)"
framework: musickit
role: symbol
role_heading: Instance Method
path: "musickit/musiclibrarysectionedrequest/sortsections(by:ascending:)"
---

# sortSections(by:ascending:)

Sorts sections by a specified property.

## Declaration

```swift
mutating func sortSections<Value>(by keyPath: KeyPath<SectionType.LibrarySortProperties, Value>, ascending: Bool) where SectionType : MusicLibraryRequestable
```
