I made the first commit on Tonel on March 30, 2026, and by the end of the next day it had its main screens. Seven months and 533 commits later, much of the history is about making those screens correct. Timers had to survive a locked phone, data had to sync through CloudKit without duplicating, store recovery had to stop deleting data, and a workout seen by both the iPhone and the Apple Watch had to be saved to Apple Health by only one of them.

Tonel is an iOS 26 app built with SwiftUI and SwiftData, synced with CloudKit, and it is now on the App Store as a one-time US$2.99 purchase. It covers routines, live workout logging, history, a bilingual catalog of 130 exercises and personal records, plus a rest-timer Live Activity, a Quick Start widget, Siri shortcuts and a Watch companion.

I started Tonel for my own training. The gym trackers I tried kept most of the features I wanted behind a monthly subscription, so Tonel is a single purchase with everything included, no account and no ads. I also wanted a project on Apple's newest stack: the production apps I work on still support iOS 15, so Tonel targets iOS 26 only, which opened up SwiftData with CloudKit, Live Activities, App Intents, TipKit, HealthKit and a watchOS companion.

An MVP in two days

The commits from March 30 and 31 add SwiftData models, a bundled exercise catalog, four tabs, routine editing, the active workout screen with personal record detection, a post-workout summary, a history heatmap, settings and XCUITest coverage of the main flows. Most of these commits were written together with Claude Code.

Most of April's 175 commits were design and refactoring work. April also brought the first migration problem: non-optional trackingType, duration and distance properties meant existing stores could not migrate, so they became optional and lightweight migration could add nullable columns.

Timers that survive a locked phone

A June 12 commit fixed two bugs that only show up while training with the app. The rest timer counted seconds with a one-second Task, and iOS suspends that task while the phone is locked between sets, so rest time stopped counting.

The fix anchored the timer to wall-clock time, with the ticker used only to re-render. The timer became a countdown on July 2 under the same rule, and the current code in WorkoutManager reads:

guard let restStartedAt else { return }
let elapsed = Int(Date().timeIntervalSince(restStartedAt))
restSecondsRemaining = max(0, restTargetSeconds - elapsed)

Pausing shifts the anchor, so a suspended ticker still shows the right value when it resumes.

The June 12 commit also handled workouts lost when iOS killed the app. An incomplete session stayed in the store, hidden because history filters on completed sessions. The first fix salvaged these orphans into history at launch; a later audit made the device's most recent orphan, if recent, resume as the active workout.

CloudKit rewrote the data model

Turning on sync took June 15 to 17. In SwiftData the switch is one configuration value, cloudKitDatabase: .automatic, but Apple's CloudKit model guide says unique constraints aren't supported and all relationships must be optional, and its SwiftData sync article names the same two limits.

Dropping @Attribute(.unique) meant two devices could each create a PersonalRecord for the same exercise, and reading .first from an unsorted fetch showed whichever one came back. The June 17 fix added a pure best(among:) function, so every device picks the same record without coordinating.

The non-optional to-many arrays made container creation fail validation in every configuration, including the in-memory fallback, so the app crashed at launch. Each relationship is now stored as an optional array behind a computed accessor, which left every call site unchanged:

@Relationship(deleteRule: .cascade, originalName: "setLogs", inverse: \SetLog.exerciseLog)
private var setLogsStore: [SetLog]? = []

var setLogs: [SetLog] {
    get { setLogsStore ?? [] }
    set { setLogsStore = newValue }
}

A staged SchemaMigrationPlan with a V1 and V2 was added in June, and the V1 model classes were then edited in place, so V1 no longer matched any store on disk. Devices failed with "Cannot use staged migration with an unknown model version". A single VersionedSchema replaced the plan, and every new property since then is optional or has a default so that lightweight migration handles it.

The largest change undid a day-one decision to seed the catalog into the store as Exercise rows. With sync, each device seeded its own copy and the copies became duplicates. The catalog now stays in the bundled JSON and is read on demand, and logs, routine entries and records reference an exercise by an exerciseRef string (a catalog slug or a custom exercise's UUID) plus snapshots of its name and type, so deleting a custom exercise can't orphan history.

Code that runs outside the app

After a minimizable workout sheet and a rest-timer Live Activity in early July, the commit log is nearly empty until the end of September. October then has 115 commits, and much of that work runs outside the app's normal lifecycle.

A suspended app can't end its own Live Activity, so the activity is display-only. It renders Text(timerInterval:) and sets a staleDate, after which the system marks the activity as stale and the view shows "Rest over".

The Quick Start widget never opens the database. The app writes a small WidgetSnapshot to the App Group each time it moves to the background, and the widget reads only that file.

Siri shortcuts can launch the app in the background with no UI, so ContentView.onAppear may never run. App Intents receive the app's own WorkoutManager and ModelContainer through AppDependencyManager and start workouts through a startWorkoutIfIdle method that runs orphan recovery first.

Built for iOS 26 and the iPhone Duo

Since July, swiping the workout sheet down minimizes it into a mini bar placed with tabViewBottomAccessory, an iOS 26 API, which shows the exercise, elapsed time and rest countdown.

On October 30, TipKit started explaining the gestures that have no visible control: swiping a set to delete it, tapping the set number to mark a warm-up, and long-pressing a set for plates per side. The set-table tips arrive one at a time through an ordered TipGroup.

The same day, History and Exercises moved to NavigationSplitView, which shows the list and the detail side by side on an unfolded iPhone Duo and collapses to a single stack when folded.

One Health writer per workout

The Watch app displays a WatchSnapshot, and every tap becomes a WatchCommand that the phone applies through the same WorkoutManager methods its own UI calls. With Apple Health, two writers produce a duplicate workout and no writer loses it.

The phone writes the workout to Health unless the Watch acknowledges a save for that exact session; an error, a timeout or an unreachable Watch all mean the phone writes, because a rare duplicate is easier to live with than a missing workout. After the phone ends the workout, the Watch keeps its HealthKit session alive for up to 15 minutes so it can still receive the save.

Recovery that never deletes data

A September 30 audit found that when the store failed to open, the fallback deleted it and created a new one. That is harmless for an incompatible development schema and destructive for a user whose phone was woken by a CloudKit push before its first unlock, when protected data is unavailable.

A locked store is now left alone. In DEBUG builds an unreadable store is moved aside to a timestamped name together with its -wal and -shm files, and Release builds never move it, because the failure may be transient. An in-memory store is the last resort, and the app warns that nothing will be saved.

Records as derived state

Personal records are evaluated when a set is completed, so every path that edits history (uncompleting a set, deleting a session, editing logged sets, marking a set as a warm-up) recomputes them. The first cardio record ranked by distance times duration, which put 1 km in 30 minutes above 2 km in 10, and two days later it was changed to rank by pace.

Working with Claude Code

Claude Code wrote or co-wrote 188 of the 533 commits, starting on the first day and spanning five model versions: 167 carry a co-author line and 21 more are authored by Claude directly, including the June 12 timer fix and the September 30 audit. The rules in the sections above are written down in the repository's CLAUDE.md, 97 lines that are mostly invariants: store weights in kilograms, persist enums as raw strings, keep every CloudKit relationship optional, recompute records after any history edit, never delete the store file.

A project skill, ios-feature, chains brainstorming, a plan, test-first implementation, code review and verification, and checks iOS gates before each commit. The October work, from supersets to the Watch, was built over about three days with that skill in place. The store-deletion bug was found by asking an agent to audit the codebase. The suite has 349 Swift Testing tests, and CI runs them on every push to main and every pull request.

I started using Claude on Tonel to get better at working with AI. Over the months I built pipelines that take a change from the ticket through development, testing, merge review, review comments and documentation, along with project skills and agents for specific tasks, much of it learned while preparing for the Claude certifications. The more I used them, the more I was willing to try different approaches. I still wrote the initial development document, the product document and the design by hand. I think that is what matters most: an experienced developer behind the work. I can explain how every part of Tonel works, why each change was made, what failed and what worked.

Sources