One Logo Pool Ball
NowPlaying · IOS API REFERENCE

MusicContent

struct · iOS 27.0+ · SDK 27.1

struct MusicContent

Content representing a music track or song. Use this type for music playback, including songs, albums, and playlists. The following example shows how to create music content with additional metadata: ```swift var content: some MediaContentRepresentable { var content = MusicContent( id: track.id, songTitle: track.title, artistName: track.artist, albumName: track.album, type: .audio, duration: .finite(track.duration), artwork: Artwork(id: track.artworkID) { size in let data = await loadArtworkData(size: size) return try ArtworkRepresentation(data: data) } ) content.composer = track.composer content.genre = track.genre content.isExplicit = track.isExplicit return content } ```

Members (20)

get · iOS 27.0+

artistName

TypeScript
get artistName(): string
Swift declaration
let artistName: String

The name of the artist or performer.

get · iOS 27.0+

isExplicit

TypeScript
get isExplicit(): (boolean) | null
Swift declaration
var isExplicit: Bool?

A Boolean value that indicates whether this content is explicit.

set · iOS 27.0+

isExplicit

TypeScript
set isExplicit(value: (boolean) | null)
Swift declaration
var isExplicit: Bool?

A Boolean value that indicates whether this content is explicit.

get · iOS 27.0+

animatedArtwork

TypeScript
get animatedArtwork(): (AnimatedArtwork) | null
Swift declaration
let animatedArtwork: AnimatedArtwork?

Animated artwork for this content.

get · iOS 27.0+

isExcludedFromSuggestions

TypeScript
get isExcludedFromSuggestions(): (boolean) | null
Swift declaration
var isExcludedFromSuggestions: Bool?

A Boolean value that indicates whether to exclude this content from media suggestions. Defaults to `false`.

set · iOS 27.0+

isExcludedFromSuggestions

TypeScript
set isExcludedFromSuggestions(value: (boolean) | null)
Swift declaration
var isExcludedFromSuggestions: Bool?

A Boolean value that indicates whether to exclude this content from media suggestions. Defaults to `false`.

init · iOS 27.0+

init

TypeScript
static initIdSongTitleArtistNameAlbumNameTypeDurationArtworkAnimatedArtwork(id: string, songTitle: string, artistName: string, albumName: string, type: MediaType, duration: (MediaDuration) | null, artwork: Artwork, animatedArtwork?: (AnimatedArtwork) | null): MusicContent
Swift declaration
init(id: String, songTitle: String, artistName: String, albumName: String, type: MediaType, duration: MediaDuration?, artwork: Artwork, animatedArtwork: AnimatedArtwork?)

Creates music content with static and animated artwork. Use this initializer when your track has a matching animated asset, for example motion album art. - Parameters: - id: A unique identifier for this track. - songTitle: The song's display title. - artistName: The name of the artist or performer. - albumName: The album this track belongs to. - type: The media type. - duration: The total duration of the track, or `nil` when unknown. - artwork: Static artwork for the track. - animatedArtwork: Animated artwork for the track, or `nil` when unavailable.

init · iOS 27.0+

init

TypeScript
static initIdSongTitleArtistNameAlbumNameTypeDurationArtwork(id: string, songTitle: string, artistName: string, albumName: string, type: MediaType, duration?: (MediaDuration) | null, artwork?: (Artwork) | null): MusicContent
Swift declaration
init(id: String, songTitle: String, artistName: String, albumName: String, type: MediaType, duration: MediaDuration?, artwork: Artwork?)

Creates music content with the specified metadata. - Parameters: - id: A unique identifier for this track. - songTitle: The song's display title. - artistName: The name of the artist or performer. - albumName: The album this track belongs to. - type: The media type. - duration: The total duration of the track, or `nil` when unknown. - artwork: Album artwork for the track, or `nil` when unavailable.

get · iOS 27.0+

id

TypeScript
get id(): string
Swift declaration
let id: String

The unique identifier for this content.

get · iOS 27.0+

isrc

TypeScript
get isrc(): (string) | null
Swift declaration
var isrc: String?

The International Standard Recording Code (ISRC) for this content. ISRC is an industry-standard identifier for sound recordings. The system uses this value to integrate with the Music Haptics accessibility feature.

set · iOS 27.0+

isrc

TypeScript
set isrc(value: (string) | null)
Swift declaration
var isrc: String?

The International Standard Recording Code (ISRC) for this content. ISRC is an industry-standard identifier for sound recordings. The system uses this value to integrate with the Music Haptics accessibility feature.

get · iOS 27.0+

type

TypeScript
get type(): MediaType
Swift declaration
let type: MediaType

The media type (audio or video).

get · iOS 27.0+

genre

TypeScript
get genre(): (string) | null
Swift declaration
var genre: String?

The genre of this content.

set · iOS 27.0+

genre

TypeScript
set genre(value: (string) | null)
Swift declaration
var genre: String?

The genre of this content.

get · iOS 27.0+

artwork

TypeScript
get artwork(): (Artwork) | null
Swift declaration
let artwork: Artwork?

Artwork for this content.

get · iOS 27.0+

composer

TypeScript
get composer(): (string) | null
Swift declaration
var composer: String?

The name of the composer, if applicable.

set · iOS 27.0+

composer

TypeScript
set composer(value: (string) | null)
Swift declaration
var composer: String?

The name of the composer, if applicable.

get · iOS 27.0+

duration

TypeScript
get duration(): (MediaDuration) | null
Swift declaration
let duration: MediaDuration?

The duration of this content.

get · iOS 27.0+

albumName

TypeScript
get albumName(): string
Swift declaration
let albumName: String

The name of the album.

get · iOS 27.0+

songTitle

TypeScript
get songTitle(): string
Swift declaration
let songTitle: String

The title of the song.

Skipped declarations

No declarations were skipped in this snapshot.

All NowPlaying types →