The unit of work is one route or one entry point.
The durable artifact is a parser and a router with tests that list what they reject and what they replay. The chief hazard is delivery that is repeated, late, or for something that is gone.
Trace a notification: the system delivers a payload, the parser returns a route or nothing, the root view wraps a route in a request with a fresh identity, the router applies it once, and the navigation stack renders the destination. Ownership is clear. The parser validates, the router owns the path, and the view only presents.
Record the baseline with swift test --filter NavigationTests. Add a route for a technician profile, .profile, and let the compiler list every switch to update. Add a parser rule and one rejected neighbor, and a restore test that drops the route when the profile is unavailable.
Review the parser first, because it is the security boundary. Then the router’s identity handling, then restoration, then the view that wires them. Look for any path that navigates without an identity, and any .task or .onAppear that triggers navigation.
When navigation misbehaves, reproduce it with the router alone. If the bug appears without a view, the logic is wrong; if it appears only with the view, a lifecycle assumption is wrong. Write the failing test at the lowest level that shows it.
Links are untrusted. Confirm the host check is exact, credentials and ports are rejected, identifiers are validated, and no link can cause an action, only a navigation. Confirm that nothing in a link or payload reaches a log.
Test parsers with long lists of bad input. Test the router with replays, back navigation, and invalid routes. Test restoration with deleted items and corrupt data. Test the multi-scene case by creating two routers and checking they do not share a path.
Keep the list of rejected links in the repository and add to it after every incident. Agree on who owns the associated-domains declaration and the notification categories, and review them with the feature that needs them.
- Routes carry identifiers only.
- Every external request has an identity and is applied once.
- Parsing is pure and strict.
- Restoration validates every route.
- Start-up work runs once per scene.
- Why does a route hold an identifier rather than a
Job? - What goes wrong if the parser navigates?
- Why does the replay test navigate back before replaying?
- How would you test that two windows do not share a path?
Continue with the book
Explore the full treatment, worked examples, and exercises in Agentic iOS App Development.
Companion article for Agentic iOS App Development, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
