Now Playing Island

Now Playing Island

A compact black pill near the top of the screen with tiny artwork and a live waveform. Tap it and it springs open into a large rounded panel with artwork, a scrubber and controls, and a tap outside springs it closed.

Luiz Mello
  • player
  • overlay
  • animation

snippet.swift351 lines

7 files • Scroll to see all →
/// The track shown in a `NowPlayingIsland`. Artwork is a gradient plus an SF/// Symbol, so the snippet needs no assets.public struct NowPlayingIslandTrack: Identifiable, Equatable {    public let id: String    public let title: String    public let artist: String    public let duration: TimeInterval    public let systemImage: String    /// Two colors for the artwork gradient; the first also tints the waveform.    public let colors: [Color]​    public init(title: String, artist: String, duration: TimeInterval, systemImage: String, colors: [Color]) {        self.id = title + artist        self.title = title        self.artist = artist        self.duration = duration        self.systemImage = systemImage        self.colors = colors.isEmpty ? [.pink, .orange] : colors    }​    public static let samples: [NowPlayingIslandTrack] = [        .init(title: "Slow Tide", artist: "Mareva", duration: 214, systemImage: "water.waves",              colors: [Color(red: 1.0, green: 0.45, blue: 0.42), Color(red: 0.62, green: 0.22, blue: 0.62)]),        .init(title: "Paper Planes at Noon", artist: "Hollow Coast", duration: 187, systemImage: "airplane",              colors: [Color(red: 0.36, green: 0.78, blue: 0.98), Color(red: 0.24, green: 0.30, blue: 0.86)]),    ]}
Viewing: Model.swift•1 of 7