swiftship/internal/skills/data/ui/view-composition/SKILL.md
View composition: @ViewBuilder properties, section extraction, body as table of contents, naming conventions. Use when implementing UI patterns related to view composition.
npx skillsauth add abdullah4ai/apple-developer-toolkit view-compositionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Every meaningful section of a view should be a @ViewBuilder computed property:
struct TaskListView: View {
var body: some View {
NavigationStack {
VStack {
headerView
taskList
addButton
}
}
}
private var headerView: some View {
Text("My Tasks")
.font(AppTheme.Fonts.largeTitle)
.padding()
}
private var taskList: some View {
List(tasks) { task in
TaskRow(task: task)
}
}
private var addButton: some View {
Button("Add Task") {
showAddSheet = true
}
.buttonStyle(.borderedProminent)
}
}
Use descriptive suffixes:
headerSection, headerView — top areacontentSection, contentView — main contentfooterSection — bottom area{feature}Section — feature-specific (e.g., profileSection, statsSection){action}Button — action buttons (e.g., addButton, saveButton)Extract a section into its own View struct when:
@State or @Binding)The body property should be a composition of computed properties — not raw implementation:
// Good — body is a clear outline
var body: some View {
ScrollView {
headerSection
featureCards
recentActivity
}
}
// Bad — body contains raw implementation
var body: some View {
ScrollView {
VStack(alignment: .leading) {
Text("Welcome")
.font(AppTheme.Fonts.largeTitle)
// ... 50 more lines
}
}
}
testing
Use for 3D games: racing, 3D sports, board games, marble maze, tower defense, bowling. SceneKit + SceneView architecture, 3D scene hierarchy, physics, game loop, primitives, materials, cameras, particles, audio.
documentation
Game UI patterns: SwiftUI HUD overlays on SpriteKit, menus (main/pause/game-over), virtual joystick/d-pad, score displays, health bars, tutorial onboarding.
tools
Download free game sprites/textures/3D models and generate procedural assets. Covers nw_download_asset tool, texture factories, sprite atlas organization, 3D model loading, and programmatic asset creation.
testing
Use for 2D games: arcade, puzzle, sports, ping pong, platformer, shooter, 2D racing. SpriteKit + SpriteView architecture, scene hierarchy, physics, game loop, audio, particles, game feel.