---
title: "filterItems(matching:contains:)"
framework: musickit
role: symbol
role_heading: Instance Method
path: "musickit/musiclibrarysectionedrequest/filteritems(matching:contains:)-3s88f"
---

# filterItems(matching:contains:)

Filters items by a given relationship that matches a specific value.

## Declaration

```swift
mutating func filterItems<RelatedMusicItemType>(matching keyPath: KeyPath<MusicItemType.LibraryFilter, MusicItemCollection<RelatedMusicItemType>?>, contains relatedItem: RelatedMusicItemType) where RelatedMusicItemType : MusicItem
```
