Docs
Cards

Parallax Card

An image card whose picture and liquid glass caption drift at different speeds as you scroll, so the card reads in layers.

$npx swiftpieces add ParallaxCard
Free · MIT + Commons ClauseiOS 17.0+Liquid Glasscardparallaximagescrollpresscaption
Type
ParallaxCard
Files
ParallaxCard.swift
Depends on
Nothing (Apple frameworks only)
Version
2.2.0
In a full screen · SwiftPieces ProDiscoverA travel discover feed of story cards that expand into full-screen guides and pull back.

Image card with two-layer scroll parallax, press-to-lift, and a slotted liquid glass caption. The caption is a glass panel inset over the bottom of the picture, and the trailing glyph a round glass bubble resting joined to it, so a liquid neck holds the two together as one surface.

Notes

  • The drift is computed with visualEffect from proxy.frame(in: .scrollView), so the card works inside any ScrollView or List without a named coordinate space. Outside a scroll view it renders static.
  • Three layers move at different rates: the image at parallax, the caption at a third of that, and the scrim scales from 1.3x tall at the viewport center to 0.9x at the edges, so the bottom reads tighter as the card leaves. The scrim follows the square of the card's position, so it eases through the center instead of turning there. All three are pure functions of the scroll position, with no animation, so they never lag the scroll.
  • The image is oversized by height * parallax on each side and clipped, so no background shows at the extremes.
  • The caption is liquid glass: an inset panel with corners concentric to the card's, and the trailing glyph on a round glass bubble that rests joined to the panel, so a liquid neck holds the two together as one surface. On iOS 26 it is Liquid Glass; before that a frosted material with a light rim, and a solid fill under Reduce Transparency. Text and glyph on the neutral glass follow the appearance: dark ink in light mode, near white in dark. The card's shadow is cast from its outline alone, so the glass never takes it as a dark halo over the picture.
  • Pass action: to make the card a Button; the press lifts it to 1.02 rather than sinking it and deepens the shadow, arriving on a tight spring with no overshoot under the finger and settling back with a little give. The trailing bubble leans 2pt toward its arrow a beat after the card lifts, on a slightly looser spring, so the neck to the panel thins as if the arrow were pulling it out, and it returns a beat behind the card. It is a plain Button, so the standard scroll delay and cancellation apply, and a scroll that takes over the touch settles the card the same way. No haptics. Without an action it keeps a resting shadow.
  • The caption is slots: eyebrow (uppercased, tracked), title, metadata (dot-separated row), and trailingSymbol (on the glass bubble). All text is semibold; size and opacity set the hierarchy.
  • Reduce Motion disables the drift, the scrim scaling and the bubble's lean; the composition is unchanged. A press keeps the card its size: the shadow still deepens, and the card darkens slightly (lightens in dark mode, where a shadow barely shows), then lets go without overshoot.
  • ParallaxCard.Style.scrim puts white text straight over the tightening scrim, for busy photos that should stay edge to edge; its trailing bubble is dark glass so the white arrow reads.
  • style: (ParallaxCard.Style) sets caption, captionFill, captionInk, and shadowOpacity; cornerRadius defaults to 26. captionFill is now the panel's glass tint: .clear, the default, keeps it neutral. Tint it only when the colour means something, and set captionInk to an ink that reads on it. The press state reaches the caption through the environment, so VoiceOver still reads the button label.
  • v2.2: the solid caption block became a liquid glass panel, and the trailing glyph's ink circle a glass bubble joined to it. captionFill now defaults to neutral glass and captionInk to ink that follows the appearance.
  • The example renders each picture as a flat composition (a color ground, a disc, a cropped giant word) with ImageRenderer; no photos ship with the piece.
  • For an expanding card on a full discover screen, see the Pro Discover screen (hero-expand).

Usage

ParallaxCardExample()
    .preferredColorScheme(.light)

Parameters

ParameterDescription
imageThe picture to show, scaled to fill.
eyebrowOptional small uppercase line above the title, for a category or date.
titleTitle drawn in the caption.
metadataOptional short facts shown in a dot-separated row under the title.
trailingSymbolOptional SF Symbol drawn in a glass bubble joined to the caption's trailing end, for example "arrow.up.right".
heightCard height.
parallaxHow far the image drifts, as a fraction of height on each side. The caption drifts at a third of that. 0 disables the effect.
cornerRadiusCorner radius of the card.
styleCaption treatment and colors. .standard is a neutral glass panel whose ink follows the appearance; .scrim puts white text over a darkened bottom edge.
actionOptional tap handler. When set, the card lifts on press and reads as a button.

Install

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

Terminal

$npx swiftpieces add ParallaxCard

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

>Add the SwiftPieces "Parallax Card" 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 cards →

Build it yourself: SwiftUI motion guide · SwiftUI cards guide · 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.

54 screens · 46 patterns · 48 flows · 12 templates · 31 Build Kit skills

Explore Pro