The metadata associated with a file.


class NSMetadataItem : NSObject


Metadata items provide a simple interface to retrieve the available attribute names and values.


Creating a Metadata Item

init?(url: URL)

Initializes a metadata item with a given URL.

Getting Item Attributes

var attributes: [String]

An array containing the attribute keys for the metadata item’s values.

func value(forAttribute: String) -> Any?

Returns the receiver’s metadata attribute name specified by a given key.

func values(forAttributes: [String]) -> [String : Any]?

Returns a dictionary containing the key-value pairs for the attribute names specified by a given array of keys.

Item Attribute Keys


Inherits From

Conforms To

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software