Docs
Media

Now Playing

A mini player that grows into the full player in one liquid glass motion, with scrubbing, skips and a drag to fold it back.

By · Updated

Now Playing: SwiftUI Mini Player to Full Player for iOS, live preview in light mode

Now Playing, a SwiftUI Mini Player to Full Player for iOS 17+, in its live preview. Open Code for the Swift source.

$npx swiftpieces add NowPlaying
See it in a Pro app On a real screen in one of the Pro apps: open it with Pro, take it apart, remix it, and copy the SwiftUI.
Free · MIT + Commons ClauseiOS 17.0+Liquid Glassplayermusicpodcastaudiomini playermorphscrubberglasshaptics
Type
NowPlaying
Files
NowPlaying.swift
Depends on
Nothing (Apple frameworks only)
Version
1.0.0

A mini player that grows into the full player: one liquid glass shape that morphs from a bar into a card. Collapsed, it is a glass bar with the artwork, the title over the artist and a red progress hairline, with a red play bubble and a forward bubble joined to its end. Tap it, or pull it up (it stretches with the finger), and the same glass grows into a card: the artwork, title and play button fly to their places, previous and next bud out of play, and a scrubber and the times blur in. Drag the card down, or tap its grabber, to fold it back. Playback is the app's. The piece never runs a clock: it shows the time it is given, and calls back when people play, pause, skip or seek. Put it in the bottom safe area inset of your screen; the card opens over the content above the bar. swift .safeAreaInset(edge: .bottom) { NowPlaying(title: track.title, artist: track.artist, isPlaying: player.isPlaying, time: player.time, duration: track.duration, expanded: $showsPlayer, onPlayPause: { player.toggle() }, onSkip: { player.skip($0) }, onSeek: { player.seek(to: $0) }) { track.artwork.resizable().scaledToFill() } .padding(.horizontal, 12) }

Notes

  • Put it in the bottom safe area inset of your main screen, .safeAreaInset(edge: .bottom) { NowPlaying(…).padding(.horizontal, 12) }. Its layout size is only the bar, so your scroll content stops above it, and the card opens over the content above the bar, never past the top safe area.
  • Playback is yours. The piece never runs a clock: pass your player's time, duration and isPlaying, and act in onPlayPause, onSkip and onSeek. Time updates are eased linearly over the gap between them, so a player that reports once a second still creeps smoothly.
  • Collapsed, it is a glass bar (the artwork, the title over the artist, a red progress hairline) with a red play bubble and a forward bubble joined to its end on liquid necks. Tap the bar, or pull it up: the glass stretches after the finger with a rubber band's resistance, and a pull or flick that would carry past 72 points opens it; a shorter one springs back.
  • Opening is one continuous morph: forward melts into play, the same glass grows into the card, the artwork flies from its tile to its square, play flies to the middle of the transport and swells, and previous and next bud out of play and rest apart from it. The title and artist blur out as they leave the bar and back in at the card's size, so they never cross the growing artwork. A pull carries the finger's speed into the morph.
  • Drag the card down from anywhere but the scrubber and it follows the finger; let go past about a fifth of its height, or flick, and it closes: the controls blur out, previous and next melt home, the card folds into the bar and forward buds back out. Tap the grabber to close it too. expanded follows every change, and setting it from your code runs the same choreography.
  • The scrubber: touch the track anywhere and the thumb jumps under the finger and swells; the times follow, your player's updates are ignored while the finger is down, and onSeek fires once on release. The thumb then holds the new position until your time catches up (or a second and a half passes), so it never jumps back. onSeek: nil makes it a read-only progress bar.
  • Skipping: .tracks calls onSkip(.previous) or onSkip(.next); the title morphs letter by letter and the artwork blurs into the new one when your title changes. .seconds(back: 15, forward: 30) (or .podcast) shows gobackward.15 and goforward.30 and seeks through onSeek instead. Without a handler the skip bubbles don't appear.
  • States: a duration of 0 is a live stream (no hairline, no scrubber, Live in place of the times); an empty title shows "Not playing"; long titles truncate in one line; the default artwork is a sand tile with a note.
  • The card's artwork fills its width and the card hugs the height left above the bar: on a short window it shrinks, and in landscape or at the largest text sizes the card switches to a row with a small artwork beside the lines.
  • VoiceOver: collapsed, the bar is one button, "Now playing, Slow Mornings, Aster Vale", valued Playing or Paused, with Play or Pause, Next track and Open player actions. Open, focus moves to the title (a header); the scrubber is adjustable in steps of 15 seconds and reads "1 minute, 12 seconds of 3 minutes, 42 seconds"; the transport and the grabber ("Close player") are buttons, and the escape gesture closes. A skip announces the new title and artist.
  • Hardware keyboard: Space plays or pauses, Return opens, Escape closes, and the left and right arrows seek 15 seconds while open.
  • Reduce Motion: no stretch under the finger, the glass changes shape on a short ease without overshoot, the artwork and lines fade out and back in at their new places instead of flying, and the bubbles fade in place.
  • Dynamic Type: the lines, the artwork tile and the mini buttons scale, the bar grows taller and the lines truncate; the card's line heights follow, and its artwork gives way first. Right to left mirrors the bar and the card's lines; the transport, the scrubber and the hairline keep left to right, as media controls do.
  • Haptics: a light impact on play and pause, a selection tick on skip and when a finger grabs the scrubber, and a soft impact when the player lands open or closed.
  • Red marks three things only: the play bubble, the progress hairline and the played part of the track. Everything else is clear glass and house ink. All text is one weight, semibold.
  • Style sets the accent and its ink, the label colours, the track, the thumb, the grabber and the placeholder tile. Messages replaces any of the copy and the VoiceOver strings, such as untitled: "Nothing queued".

Usage

NowPlayingExample()

Parameters

ParameterDescription
titleThe track, episode or station. It morphs letter by letter when it changes, and truncates when it doesn't fit. An empty title shows messages.untitled.
artistThe secondary line: the artist, show or author.
isPlayingWhether the app is playing. The red play bubble shows pause while it is true.
timeThe playback position in seconds, from your player. Updates between ticks are eased, so the hairline and the scrubber creep smoothly at any update rate. While people scrub, updates are ignored.
durationThe length in seconds. 0 (or any value that isn't positive and finite) is a live stream: the hairline, the scrubber and the times give way to messages.live.
expandedWhether the full player is open. Bind it to open or close the player from your own code; any change animates.
skippingWhat the skip buttons do: .tracks (previous and next, through onSkip, the default) or .seconds(back:forward:) for podcasts and audiobooks (through onSeek).
messagesThe built-in copy and VoiceOver strings. Defaults are localizable through your String Catalog; replace any line.
styleColors. Defaults to the SwiftPieces house palette, adapting to light and dark, with red for play, the hairline and the played part of the track.
onPlayPauseCalled when the play bubble is tapped (or Space is pressed). Toggle your player here.
onSkipCalled with .previous or .next in .tracks mode. nil hides the skip bubbles.
onSeekCalled once with the new position when a scrub ends, a seconds skip is tapped, or VoiceOver adjusts the scrubber. nil makes the scrubber a read-only display.
artworkThe artwork, filled into a square. Omit it for a house tile with a note. It blurs into the new one whenever the title or artist changes.

Install

Pick one. Run it from the folder that contains your .xcodeproj and the files land inside your app.

Terminal

$npx swiftpieces add NowPlaying

Or ask your coding agent · Claude Code, Cursor or Xcode, once the MCP server is connected

>Add the SwiftPieces "Now Playing" piece to my app

Or copy the source above into your app.

New to SwiftUI?If you know React, CSS or Tailwind, SwiftUI is easier to pick up than it looks.Try real app patterns first

Building a whole app? See SwiftPieces Pro →

All media →

Build it yourself: SwiftUI animations guide

On this page

SwiftPiecesPro

Build the whole app with one library.

Production-ready screens, whole flows, complete app templates, a Build Kit your agent follows and Pro remixing.

Explore Pro