Screen · Education

New

Passport

Progress as passport stamps you collect, with your streak, your totals and today's new stamp pressed in.

A progress tab with a sense of place: each finished unit is a stamp in a passport, inked in its color with its own shape, glyph, date and a slight tilt, and the ones ahead wait as dashed outlines with what opens them. Your streak sits on top on a warm card with the week's days, your totals sit on pressable tiles that open into their week, and a stamp you've just earned comes into view and lands with a thud and a spread of ink.

SwiftUIiOS 17.0+passport-stamps

Get Swift Pieces Pro

$199 once, every piece included. See how installing works · Sign in

01

What's included

SwiftUI source you own, built on Apple frameworks only.

  • Finished units as inked stamps, each with its own shape, glyph, date and tilt
  • A new stamp lands with a thud, a haptic and a spread of ink
  • Your streak with the week's days on a warm card
  • Totals on pressable tiles that open into their week
  • Stamps ahead wait as dashed outlines with what unlocks them

Used in

Language App (template)

02

Implementation notes

How it behaves, what it handles, and the decisions behind it.

Progress reads like a passport you fill. Every finished unit is a stamp inked in that unit's color, each in its own outline (a scalloped circle, a rounded square, an oval, a notched ticket or a hexagon) with a double rule, a drawn glyph, the place in capitals and the date. Each one sits at a slight tilt and carries a fine speckle where the ink skipped, both drawn from the stamp's seed so it always looks the same. The stamps ahead wait as dashed outlines with what opens them. Your streak sits on top, on a warm card with a big flame and the week's days, and your totals sit on tactile tiles: tap one and it opens into its week as seven chunky bars, then tap again to close it. A stamp you've just earned drops onto the page from above, lands with a heavy haptic, spreads a ring of ink and throws a few sprinkles while Pip cheers, once.

Notes

  • PassportStamps(profile:streak:totals:stamps:newStamp:onSettings:) takes a PassportProfile (name, a line under it and the level chip), a PassportStreak (days, best and this week's days), up to three PassportTotals (title, value, block, symbol and the week's values) and every unit's PassportStamp in course order.
  • A stamp has its place, unit, unitNumber, block, shape and glyph, the date it was earned (nil while it is ahead), what unlocks it, its lessons and words, and a seed for its tilt and speckles. The nine glyphs (cup, tram, basket, museum, sun, key, plate, ticket and star) are drawn in code and match the web preview path for path.
  • Set newStamp to the id of the stamp just earned and the page brings it into view, then lands it once. Tap any earned stamp for its page, with the unit, the date, its lessons and words and Practice this unit (onPractice).
  • The gear key calls onSettings; pass nil to hide it. With no stamps earned yet, the first stamp's outline says what earns it, and isLoading shows grey tiles and stamps.
  • The tiles, keys and cards are spTactileSurface and SPTactileStyle from the design system and the coach is SPBuddy, so the page takes the theme's blocks, type and radii.
  • VoiceOver reads each stamp as its unit, place and date (or what unlocks it), the streak as one value with each day after it, and the totals as buttons that open and close their week. Text grows with Dynamic Type and the page scrolls.
  • Reduce Motion places a new stamp without the drop, the ink or the sprinkles, and the tiles open with a short fade.
  • PassportStampsExample at the end of PassportStamps.swift is the screen in the preview: a learner nine units into a course, four stamps earned and the newest landing, with Parla's chunky tab bar. Copy it as a starting point.