DroppyNowPlayingPlayer

Droppy's floating player, the real one: the same view, glass, artwork, controls and lyrics button the floating player and the lock screen draw, showing whatever is playing on the Mac.

@MainActor struct DroppyNowPlayingPlayer

Droppy's floating player, the real one: the same view, glass, artwork, controls and lyrics button the floating player and the lock screen draw, showing whatever is playing on the Mac. A droplet that would otherwise draw a now-playing card of its own puts this in its place, so the user sees one player everywhere instead of a look-alike. Since 1.21.0.

Give it the size and corner radius of the cards around it and the host lays the player out at that size, never scaled: its artwork grows with the extra height and every row follows, so text and controls stay crisp. minimumSize is the smallest it lays itself out at, a little narrower than its own size; a smaller slot gets the minimum, which you scale yourself. Its output button swaps the card for Droppy's output list in place, and back once one is picked.

if let minimum = DroppyNowPlayingPlayer.minimumSize {
    DroppyNowPlayingPlayer(size: cardSize, cornerRadius: cardRadius)
        .frame(width: max(cardSize.width, minimum.width),
               height: max(cardSize.height, minimum.height))
} else {
    MyOwnNowPlayingCard()
}

size and minimumSize are nil wherever the host draws no player: the harness, a preview, a Droppy too old to have one. Fall back to your own view then; the player itself draws nothing there.

A droplet that must keep loading on hosts before 1.21.0 can still use it: import DroppyKit with @_weakLinked, keep kit.minAPI at its old value, and check #_hasSymbol(DroppyNowPlayingPlayer.self) before touching it. droppykit validate counts a weakly imported symbol as optional and names it (Scripts/api-optional.txt). Check it at minAPI 1.21.0 too: the Droppy betas 16.1.2-beta.1 through 16.1.2-beta.4 report 1.21.0 and predate the player.

Initializers

init()

@MainActor init()

The player at its own size and corner radius.

init(size:cornerRadius:)

@MainActor init(size: CGSize, cornerRadius: CGFloat? = nil)

The player laid out at size (never smaller than minimumSize) with cornerRadius, or its own radius when nil.

Type properties

minimumSize

@MainActor static var minimumSize: CGSize? { get }

The smallest size in points the player lays itself out at, or nil where the host draws none.

size

@MainActor static var size: CGSize? { get }

The player's own size in points, what init() draws, or nil where the host draws none.

Properties

body

@MainActor var body: some View { get }