Navigation and State in SwiftUI: Reviewing Agent Output

← Back to Blog & Articles

SwiftUI makes screens easy to write, which is why agents produce them readily. The subtle issues are in state and navigation, so that is where review should focus.

State ownership

Check that each piece of state has one clear owner. Misusing local state, bindings, and observable objects can cause views not to update, update too often, or lose data.

Navigation patterns

Decide how your app represents navigation, for example with a path or route type, and document it. Without guidance, an agent may mix patterns and create flows that are hard to maintain.

Asynchronous work

Verify that network and database calls run off the main thread and that results update state on the main actor. Look for tasks that are not cancelled when a view disappears.

Loading, empty, and error states

Agents often implement only the success case. Ask explicitly for the others, and review them in previews.

Use previews as fast checks

SwiftUI previews with sample data let you see states quickly. Require previews for new views so that review is easier.

Accessibility

Check labels, dynamic type, and contrast. These are often omitted unless requested.

Takeaway

Look beyond whether the screen renders: check ownership of state, navigation consistency, and the non-happy-path behavior.

Continue with the book

Explore the full treatment, worked examples, and exercises in Agentic iOS App Development.


Adapted from Agentic iOS App Development, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.

Scroll to Top