Type Method

metadataItems(from:withKey:keySpace:)

Provides an array of metadata items that match a specified key or key space.

Declaration

class func metadataItems(from metadataItems: [AVMetadataItem], withKey key: Any?, keySpace: AVMetadataKeySpace?) -> [AVMetadataItem]

Parameters

array

The array of AVMetadataItem objects to be filtered.

key

The key that must be matched for a metadata item to be included in the output array. The key is compared to the keys in the metadata in the array using isEqual(_:).

If you do not want to filter by key, pass nil.

keySpace

The key space that must be matched for a metadata item to be included in the output array. The key space is compared to the key spaces in the metadata in the array using isEqual(to:).

If you do not want to filter by key space, pass nil.

Return Value

An array of the metadata items from array that match key or keySpace.

Discussion

If the value in the keySpace parameter is common, the value of the metadata item’s commonKey property must match the value in the key parameter for the item to be returned. If the key parameter is nil, then all metadata items in the common key space are returned.

If the value in the keySpace parameter is nil or is not the constant for the common key space, the value of the metadata item’s key property must match the value in the key parameter for the item to be returned. If the key parameter itself is nil, then all metadata items in the specified key space are returned.

See Also

Filtering Arrays of Metadata Items

struct AVMetadataKeySpace

A value that defines a metadata key space.

class func metadataItems(from: [AVMetadataItem], with: Locale) -> [AVMetadataItem]

Provides an array of metadata items that match a specified locale.

class func metadataItems(from: [AVMetadataItem], filteredAndSortedAccordingToPreferredLanguages: [String]) -> [AVMetadataItem]

Provides the subset of metadata items whose locales match one of the specified language identifiers.

struct AVMetadataIdentifier

A value that defines the metadata identifiers for different file formats.