Class

MLMediaGroup

The MLMediaGroup class provides groupings for media objects from a single source of media, such as iTunes or Aperture. The media objects—individual files containing a piece of media such as a photo, song, or movie—are referenced by one or more groups within each media source. These groupings serve as filters, providing hierarchical structure to the collection of objects in each source.

Declaration

@interface MLMediaGroup : NSObject

Overview

The structure of the group hierarchy is specific to each media source, but all sources have certain commonalities. For example, every source has a single root media group, which contains all groups and objects within that source. It is the highest-level parent group in the hierarchy and each of its descendant groups contains its own subgroups and their objects. All groups have a reference to their parent within the hierarchy. A group with no descendants contains only its own objects. If a media group does not contain any objects, it is not visible in the hierarchy.

A media group has an array of attributes which can change at any point. For example, a media group may have certain attributes that describe its objects, but these attributes appear only after the objects for that group have been loaded. When any media group attribute changes, observers are notified via KVO notification. For information about handling attributes that change, see Cocoa Bindings Programming Topics.

Every media group has a unique identifier as well as a type identifier. In certain cases, multiple groups within a source can have the same type identifier. For descriptions of group type identifiers, see MediaLibrary Constants.

All MLMediaGroup properties are read-only, so this information can be accessed but not altered.

Topics

Identifying the Group

identifier

An identifier for the media group.

typeIdentifier

An identifier for the media group’s type.

mediaSourceIdentifier

An identifier for the source that loaded the media group.

mediaLibrary

A pointer to the media library instance that loaded the media group’s source.

Accessing Group Attributes

attributes

A dictionary of attributes describing the media group.

name

The name of the media group.

iconImage

The media group’s icon.

URL

The location of the media group.

modificationDate

The date and time when the media group was last altered.

Accessing the Group Hierarchy

parent

The media group’s parent group.

childGroups

A list of child groups contained in the media group.

mediaObjects

A list of media objects in the media group.

Relationships

Inherits From