Mobile and desktop apps · Skill
Build an iOS project with SwiftUI
build-swiftui-for-ios
Starts or extends an iOS phone and iPad project in SwiftUI - stacks, tabs, split view, observable state, and lists - using current APIs and the project's deployment target. Use when the user wants a SwiftUI project, a NavigationStack, or to replace a deprecated NavigationView.
Works with: Any AI Not yet model-tested; testing Jan 2027
Paste it into ChatGPT, Claude, Gemini or any AI chat, then tell it about your project. How it works
Install in Claude Code, Cursor or Codex (optional)
Only for AI coding tools that read skill folders. Run one line in a terminal, in your project folder. It downloads this skill's text files from TheSkillVault and nothing else; you can read them first with “View raw SKILL.md”.
Claude Code (all your projects)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-swiftui-for-ios/raw' -o ~/'.claude/skills/build-swiftui-for-ios/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-swiftui-for-ios/files/LICENSE.txt' -o ~/'.claude/skills/build-swiftui-for-ios/LICENSE.txt'Cursor (this project)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-swiftui-for-ios/raw' -o '.cursor/skills/build-swiftui-for-ios/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-swiftui-for-ios/files/LICENSE.txt' -o '.cursor/skills/build-swiftui-for-ios/LICENSE.txt'Codex and other Agent Skills tools (this project)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-swiftui-for-ios/raw' -o '.agents/skills/build-swiftui-for-ios/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/build-swiftui-for-ios/files/LICENSE.txt' -o '.agents/skills/build-swiftui-for-ios/LICENSE.txt'
Or connect the whole library over MCP
Add TheSkillVault to Cursor or add this to your app's MCP settings (read-only; help):
{
"mcpServers": {
"theskillvault": {
"url": "https://theskillvault.ai/mcp"
}
}
}SwiftUI is the UI toolkit for iOS phone, iPad and Mac. Read the project's deployment target ahead of picking an API. Newer calls belong behind a check when the target is older.
When to use
- The user wants a new iOS phone and iPad project in SwiftUI.
- Existing screens still use the deprecated NavigationView.
- State is a pile of loose values and the view redraws too widely.
When not to use
- The project is React Native or Expo. Do not rewrite it in SwiftUI.
- The user only wants to know whether the iOS phone should use a tab bar or a sidebar. That choice is a separate skill.
- The user wants a visual pass on type, symbols and spacing only. That is a screen-design skill.
Steps
- Read the deployment target in the Xcode project. Use an API only when that target supports it, or inside an availability check. Do not change the target unless the user asks.
- Give each feature its own Swift file. Do not stack several view types in a single file.
- For a pushed flow, use NavigationStack. Register navigationDestination(for:) once per data type in that stack. Do not also use the old NavigationLink(destination:) in the same stack. Flag any leftover NavigationView.
- On iOS phone, put the main sections in a TabView. On iPad and Mac, use NavigationSplitView so the layout can show a sidebar plus detail.
- Keep state in the smallest view that reads it. Prefer @Observable for a shared model. Pass only the fields a child reads.
- Long collections go in a List or a lazy stack, not a VStack that builds every row at once.
- Add an accessibility label on icon-only controls. Support Dynamic Type. Skip motion when Reduce Motion is on.
- Build for the destination you named. A Mac layout must still make sense when it is resized.
Gotchas
- Do not put passwords, tokens or private records in sample previews.
- Mixing navigationDestination(for:) with NavigationLink(destination:) in a single stack breaks pushes. Pick the value-based form.
- Do not add a third-party UI kit unless the user asks. Stay in SwiftUI.
- This is an independent how-to adapted from Paul Hudson's skill. It is not Apple documentation, and it was not run in Xcode for this library.
Portability
The same screen on Android belongs in Jetpack Compose, not SwiftUI. If you use React Native, keep that stack. A Mac-only tool can still be SwiftUI with NavigationSplitView. UIKit is only for a gap SwiftUI cannot cover, and only when the user asks.
Done when
- Pushes use NavigationStack and value-based destinations.
- iOS phone sections are tabs, and iPad or Mac can show a split view.
- The deployment target was checked, and icon buttons have labels.
Example prompt
"Create a SwiftUI iOS phone and iPad project with tabs for Home and Settings, and a stack push into a detail screen. Use Observable for the model."
---
Adapted from "swiftui-pro" by Paul Hudson in twostraws/SwiftUI-Agent-Skill (MIT, Copyright (c) 2026 Paul Hudson.). See LICENSE.txt.
Bundled files
Licence
Adapted from Paul Hudson (twostraws/SwiftUI-Agent-Skill, swiftui-pro) (Copyright (c) 2026 Paul Hudson.), MIT License. Adapted by TheSkillVault: rewritten as a short starter (target check, stack, tabs, split view, observable state, lists); dropped the review checklist and reference-file router; added gotchas and done-when. Independent how-to, not official Apple or twostraws documentation.
Licence: MIT License. Attribution when you reuse it: Based on work by Paul Hudson (twostraws/SwiftUI-Agent-Skill, swiftui-pro) (Copyright (c) 2026 Paul Hudson., MIT License), https://github.com/twostraws/SwiftUI-Agent-Skill/tree/f2920b63995263f57b3e198674e89a602efba6d2/swiftui-pro; adapted by TheSkillVault, https://theskillvault.ai