Instance Method

value(forProperty:)

Retrieves the value for a specified media property key.

Declaration

func value(forProperty property: String) -> Any?

Parameters

property

The media property key that you want the corresponding value of.

Return Value

The value for the media property key.

Discussion

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.

Use enumerateValues(forProperties:using:) to efficiently access more than one property at a time.

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.

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

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

var persistentID: MPMediaEntityPersistentID

The persistent identifier for a media entity.

subscript(Any) -> Any?

Returns the object specified by the key.

typealias MPMediaEntityPersistentID

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