SwiftUI walkthrough

Designing a Glassy Arrow Date Selector in SwiftUI

A step-by-step walkthrough of a glassy, steel-style date selector built with SwiftUI, focusing on design tokens, gradients, and motion.

24 May 2026 · 15 min read

We build the main screen of ArrowDateSelector: a glassy date selector that steps one day at a time with steel-style arrow buttons, smart labels like “Today” and “Tomorrow”, and smooth motion.

What we’re building

  • A date selector that steps forward/backward one day at a time
  • Steel/glass-style circular arrow buttons with a reflection and metallic rim
  • Smart labels: Today, Tomorrow, Yesterday, or a localized date like “March 15”
  • Haptics and accessibility so it feels right on device
  • Two Swift files — ArrowButton.swift for the control, ContentView.swift for the screen

Requirements: Xcode 15 or later, iOS 17 or later, and basic SwiftUI experience.

1. Design tokens: metrics and colors

Start in ArrowButton.swift by centralising button metrics in a private ArrowButtonMetrics enum — the same way Chapter 1 locked sizes in Figma before touching effects. Button size, reflection diameter, blur amount, stroke width, and shadow values all live here.

SwiftLine 1, Col 1

The steel background palette lives in ContentView.swift. buttonFill — the face of the circle — stays in ArrowButton.swift next to the control that uses it.

SwiftLine 1, Col 1
SwiftLine 1, Col 1

2. Gradients for background and reflection

ContentView.swift owns LinearGradient.appBackground — the diagonal steel backdrop from Chapter 1’s base fill. ArrowButton.swift owns reflectionFill — the vertical grey gradient behind the frosted core.

SwiftLine 1, Col 1
SwiftLine 1, Col 1

3. Building the steel ring as a ViewModifier

The metallic ring from Chapter 1’s four stroke layers becomes CircularSteelStrokeOverlay in ArrowButton.swift. Four stroked circles with gradients and blend modes — two darken the edges, two add highlights. visibleStrokeCount lets the in-app tutorial reveal strokes one at a time, matching the build progression carousel above.

SwiftLine 1, Col 1

4. Composing the ArrowButton

ArrowButton stacks the fill, frosted reflection, steel ring, and arrow icon. The reflection is a blurred circle offset downward — closer to Chapter 1’s frosted core than a flat rectangle. The date selector passes step: .complete so all four strokes, blur, and the arrow render at once.

SwiftLine 1, Col 1

5. Managing date state and label logic

ArrowDateSelectorView in ContentView.swift owns a single @State currentDate. formattedLabel picks Today, Tomorrow, Yesterday, or a localized date. showsDetailedDate controls the second line with weekday + full date.

SwiftLine 1, Col 1

6. Laying out the selector

The body is a ZStack with appBackground edge to edge, then an HStack: previous arrow, date labels, next arrow. Negative spacing pulls the arrows toward the centre; scaleEffect(0.4) keeps them control-sized rather than hero-sized.

SwiftLine 1, Col 1

7. Motion, haptics, and accessibility

Labels animate with .contentTransition(.numericText()) and a spring keyed off formattedLabel. HapticsHelper wraps UIImpactFeedbackGenerator and bails out in previews so the canvas stays stable.

SwiftLine 1, Col 1

Arrows get explicit accessibility labels, the decorative arrow image is hidden from VoiceOver, and the label stack combines into one element. The whole view hides from accessibility in previews to avoid canvas crashes on complex trees.

8. Previewing the design

ContentView.swift ends with a #Preview that renders ArrowDateSelectorView in dark mode — the same setup you use while iterating on spacing and animation in the canvas.

SwiftLine 1, Col 1

Takeaways

  • Treat metrics and colours as design tokens so you can iterate without rewriting views.
  • Wrap visual effects like the steel ring in ViewModifiers to make them portable.
  • Layer simple shapes—gradients, blurs, strokes—to get a complex glass/metal look.
  • Keep view bodies clean with computed properties for labels and visibility flags.
  • Guard haptics in previews so you can lean on the SwiftUI canvas while designing.
  • Think about accessibility from the start: labels, combined elements, and hidden decoration.

You can explore the full source — ArrowButton.swift, ContentView.swift, and assets — in the swiftuibuttons GitHub repository.