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.


@interface MLMediaGroup : NSObject


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.


Identifying the Group


An identifier for the media group.


An identifier for the media group’s type.


An identifier for the source that loaded the media group.


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

Accessing Group Attributes


A dictionary of attributes describing the media group.


The name of the media group.


The media group’s icon.


The location of the media group.


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

Accessing the Group Hierarchy


The media group’s parent group.


A list of child groups contained in the media group.


A list of media objects in the media group.


Inherits From