SwiftUI screen patterns
Builds SwiftUI screens and navigation from proven patterns for state, routing and loading.
Claude's review
8/10 Proven SwiftUI patterns for state, navigation, presentation and loading phases.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
Builds SwiftUI screens and app structure from a small set of proven patterns: who owns each piece of state, a tab-and-navigation-stack app shell, enum-driven routes and sheets, async loading with explicit phases, searchable lists, form sheets and previews for every state. States the minimum OS for each API and gives the fallback for older targets. Use when the user says "build this screen in SwiftUI", "set up navigation for my app", "TabView with NavigationStack", "how should I pass this model down", "show a sheet from a list row", "handle loading and error states", "add deep links", or starts a new SwiftUI app.
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: swiftui-ui-patterns
description: >-
Builds SwiftUI screens and app structure from a small set of proven patterns: who owns each piece of state, a tab-and-navigation-stack app shell, enum-driven routes and sheets, async loading with explicit phases, searchable lists, form sheets and previews for every state. States the minimum OS for each API and gives the fallback for older targets. Use when the user says "build this screen in SwiftUI", "set up navigation for my app", "TabView with NavigationStack", "how should I pass this model down", "show a sheet from a list row", "handle loading and error states", "add deep links", or starts a new SwiftUI app.
license: Apache-2.0
compatibility: "SwiftUI with Xcode 16 or later. Patterns are written for iOS 17+ / macOS 14+ (Observation); the Tab API needs iOS 18 / macOS 15. Fallbacks for iOS 16 are noted."
metadata:
author: terminal-skills
version: "2.0.0"
category: development
tags: "swiftui, ios, navigation, state-management, ui-patterns"
---
# SwiftUI UI Patterns
## Overview
Most SwiftUI screens are assembled from the same few decisions: where each piece of state lives, how the user moves between screens, how modal presentations are triggered, and what the view shows while data is loading, missing or broken. Getting these right once makes the rest of the view code short. This skill gives one pattern for each decision, with the API availability checked against Apple's documentation, and two complete examples to copy the shape from. It deliberately leaves out component catalogues: for a single control, read its documentation page.
## Instructions
### 1. Look before writing
- **Deployment target** decides which column of the tables below applies. Find it in the project settings or `Package.swift` (`platforms:`).
- **House style.** Search for the nearest existing screen and match it: `grep -rnE "NavigationStack|NavigationSplitView|TabView|\.sheet\(" --include="*.swift" .` Do not introduce a second navigation or state style into a project that already has one.
- **Xcode version.** With Xcode 27 or later `@State` is a macro that creates a class-typed initial value once. With Xcode 26 or earlier it is a property wrapper, and the initial-value expression runs every time the view is initialised (only the first result is kept). On older Xcode, keep model initialisers cheap or create the model in `.task`.
### 2. Decide who owns each piece of state
Pick the owner first, then the declaration follows.
| The data is | Owner writes | A child that receives it writes | Before iOS 17 |
|---|---|---|---|
| A value used by one view (toggle, text, selection) | `@State private var` | `@Binding var` if it edits, `let` if it reads | same |
| A reference model created by this view | `@State private var model = CartModel()` on an `@Observable` class | `let model: CartModel` to read; `@Bindable var model` when it needs `$model.field` | `@StateObject` / `@ObservedObject` on an `ObservableObject` |
| A service shared by many screens | `.environment(client)` near the root | `@Environment(LibraryClient.self) private var client` | `.environmentObject` / `@EnvironmentObject` |
| A system value (dismiss, locale, color scheme) | provided by SwiftUI | `@Environment(\.dismiss) private var dismiss` | same |
Rules: state is `private` and lives in the highest view that needs it, no higher. Pass leaf views the values they display, not the whole model. Reading a type from the environment that nobody injected throws at run time; declare it optional (`private var client: LibraryClient?`) when it may be absent. Plain values in `@State` are enough for most screens; add a model class when logic must be shared or tested.
...From TerminalSkills's repository, Apache-2.0 licence.
Related skills
-
Checked
Android Gradle Plugin upgrade
Moves Kotlin Multiplatform projects to Android Gradle Plugin 9 and fixes the build failures it causes.
8/101 credit -
Checked
CocoaPods to SwiftPM
Moves Kotlin Multiplatform projects from CocoaPods to Swift Package Manager and updates the Xcode project.
8/101 credit -
Checked
Kotlin Native build speed
Diagnoses and fixes slow Kotlin/Native iOS builds in Kotlin Multiplatform projects, both locally and on CI.
7/101 credit -
Checked
SwiftUI Liquid Glass
Adds and reviews Liquid Glass in SwiftUI apps for iOS 26, avoiding pitfalls with bars, buttons and scrolling.
7/101 credit -
Checked
Native Mobile App Design
Designs Expo and React Native screens that feel truly native, with proper navigation, motion and dark mode.
7/101 credit -
Checked
EAS cloud simulators
Runs your app on Expo's cloud iOS and Android simulators, so you can test without a local simulator.
7/101 credit