Screen · Media

Reading Year SwiftUI Screen

The year's books against a goal: a ring with your pace, the year in figures, a shelf of spines by month and the passage of the month.

A reading year: a ring that fills toward the year's goal with a pace line (ahead, on track or behind), pages, hours and your longest streak, then every book finished this year as a spine on a drawn shelf, as thick as its page count, with the months marked and a sort by month or by length. The highlight of the month closes the screen.

  • SwiftUI
  • iOS 17.0+
  • reading-year
Get SwiftPieces 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.

  • A goal ring with your pace: ahead, on track or behind
  • Pages, hours and the longest streak of the year
  • Every finished book as a spine, as thick as it is long
  • Months marked under the shelf, sorted by month or by length
  • The highlight of the month as a card

Used in

Reading App (template)

02

Implementation notes

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

The year's title sits beside a goal chip, "Goal · 30 books". Under it a ring fills toward the goal with the count large in the middle and a pace line beside it: two books ahead, on track, or one behind, worked out from how many a steady pace would have finished by today. Pages, hours and the longest streak follow as three figures. Then every book finished this year stands on a drawn shelf as a spine in its own block, as thick and as tall as its page count, with the first letter of each month marked under the spines where that month starts. A menu sorts the shelf by month or by length, and the spines stand up in turn when the screen appears. The highlight of the month closes the screen as a card with the passage, the book and the page.

Notes

  • ReadingYear(year:goal:books:expected:totals:) takes the books finished this year as ReadingYearBooks with their dates, and expected, the books a steady pace would have finished by today (goal × day of year ÷ days in year). The pace line compares the two.
  • ReadingYearTotals carries the pages, minutes and longest streak. Pass a ReadingYearHighlight for the highlight of the month, or nil to leave the card out.
  • onGoal makes the goal chip a button; nil keeps it as text. onOpen gets the spine you tapped and onHighlight the card.
  • The shelf works its spine widths out to fill the row exactly, so the month marks line up under the spines, and it wraps onto a second row past eighteen books.
  • The ring is one VoiceOver element ("Reading goal, 18 of 30 books"), and each spine is a button with its title, author and the day it was finished. Under Reduce Motion the spines fade in instead of standing up.
  • ReadingYearExample at the end of ReadingYear.swift is the screen in the preview: eighteen of thirty books in 2026, two ahead of pace, in the Phosphor showcase preset. Copy it as a starting point.