Class

MPMediaPropertyPredicate

A set of predicates that define a filter used in a media query.

Overview

Use one or more MPMediaPropertyPredicate objects to define the filter in a media query to retrieve a subset of media items from the Music library. A predicate in this context is a statement of a logical condition that you want to test each media item against. Those items that satisfy the condition are retrieved in the query result.

You define Music library queries, and retrieve query results, using the MPMediaQuery class. The media items and media item collections that you retrieve with a query are described in MPMediaItem and MPMediaItemCollection.

Topics

Creating Media Property Predicates

init(value: Any?, forProperty: String)

Creates a media property predicate with the default comparison type.

init(value: Any?, forProperty: String, comparisonType: MPMediaPredicateComparison)

Creates a media property predicate with a specified comparison type.

Examining Media Property Predicates

var property: String

The property that the media property predicate uses when you invoke a query.

var value: Any?

The value that the media property predicate matches against when you invoke a query.

var comparisonType: MPMediaPredicateComparison

The type of matching comparison that the media property predicate performs when you invoke a query.

Supporting Types

enum MPMediaPredicateComparison

Logical comparison types for media queries.

Relationships

Inherits From

See Also

Media Item Queries

Using Filters to Create Specialized Queries

Add a filter set to a query before populating a music player queue.

class MPMediaQuery

A query that specifies a set of media items from the device's media library by way of a filter and a grouping type.

class MPMediaQuerySection

A range of media items or media item collections from within a media query.

class MPMediaPredicate

An abstract class that defines classes for filtering media in a media query.