---
title: collections
framework: mediaplayer
role: symbol
role_heading: Instance Property
path: mediaplayer/mpmediaquery/collections
---

# collections

An array of media item collections whose contained items match the query’s media property predicate.

## Declaration

```swift
var collections: [MPMediaItemCollection]? { get }
```

## Discussion

Discussion The system groups and sorts the returned array of collections by the groupingType of the media query. The following code listing demonstrates how to use this property: Each element of the collections array now contains a media item collection. Each collection contains the media items from the library by a particular artist. The system sorts elements of the array by the artist name. For the available grouping types, see MPMediaGrouping.

## See Also

### Performing media queries

- [items](mediaplayer/mpmediaquery/items.md)
