---
title: "filter(matching:contains:)"
framework: musickit
role: symbol
role_heading: Instance Method
path: "musickit/musiclibraryrequest/filter(matching:contains:)-9756l"
---

# filter(matching:contains:)

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

## Declaration

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