---
title: "init(value:forProperty:)"
framework: mediaplayer
role: symbol
role_heading: Initializer
path: "mediaplayer/mpmediapropertypredicate/init(value:forproperty:)"
---

# init(value:forProperty:)

Creates a media property predicate with the default comparison type.

## Declaration

```swift
init(value: Any?, forProperty property: String)
```

## Parameters

- `value`: The property value that you want to match when you query the Music library. For example, if you specify the doc://com.apple.mediaplayer/documentation/MediaPlayer/MPMediaItemPropertyArtist constant in the forProperty parameter, in this parameter you supply a string containing the artist name.
- `property`: A property to use to build a media property predicate. See Media item types and keys.

## Return Value

Return Value A media property predicate.

## Discussion

Discussion This is a convenience method that uses the default logical comparison type of MPMediaPredicateComparison.equalTo.

## See Also

### Creating media property predicates

- [init(value:forProperty:comparisonType:)](mediaplayer/mpmediapropertypredicate/init(value:forproperty:comparisontype:).md)
