Instance Method

enumerateValues(forProperties:using:)

Executes a provided block with the fetched values for the given item properties.

Declaration

func enumerateValues(forProperties properties: Set<String>, using block: @escaping (String, Any, UnsafeMutablePointer<ObjCBool>) -> Void)

Parameters

properties

A set of property keys that you want the values for.

block

A block object that executes for each fetched property value. If a value is not available, your block is sent nil.

Discussion

Use this method to get property values in a batch fashion. Anytime the app accesses more than one property, enumerating over a set of property keys is more efficient than fetching each individual property with value(forProperty:).

The media property keys you can use with this property are listed in this document and in General Media Item Property Keys, Podcast Item Property Keys, Playlist Property Keys, and User-Defined Property Keys.

See Also

Working with Media Properties

class func canFilter(byProperty: String) -> Bool

Indicates if a media property key can be used to construct a media property predicate.

var persistentID: MPMediaEntityPersistentID

The persistent identifier for a media entity.

subscript(Any) -> Any?

Returns the object specified by the key.

func value(forProperty: String) -> Any?

Retrieves the value for a specified media property key.

typealias MPMediaEntityPersistentID

Defines the type for storing a persistent identifier to a particular entity.