skills/swift_swiftui/SKILL.md
SwiftUI framework concepts including property wrappers, state management, and reactive UI patterns.
npx skillsauth add swiftzilla/skills swift_swiftuiInstall 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.
This skill covers SwiftUI framework concepts for building declarative user interfaces.
SwiftUI is Apple's modern declarative framework for building user interfaces across all Apple platforms using a reactive, state-driven approach.
Need local mutable state?
├── YES → Is it a value type?
│ ├── YES → Use @State
│ └── NO → Use @StateObject
└── NO → Shared from parent?
├── YES → Is it value type?
│ ├── YES → Use @Binding
│ └── NO → Use @ObservedObject
└── NO → Use @Environment
| Wrapper | Owns Data | Data Type | Use For | |---------|-----------|-----------|---------| | @State | Yes | Value type | Local UI state | | @Binding | No | Value type | Shared state with parent | | @ObservedObject | No | Reference type | Injected dependencies | | @StateObject | Yes | Reference type | Owned view models | | @Environment | No | Any | Shared resources |
// Local state
struct CounterView: View {
@State private var count = 0
var body: some View {
Button("Count: \(count)") { count += 1 }
}
}
// Shared state (parent to child)
struct ParentView: View {
@State private var isOn = false
var body: some View {
ChildView(isOn: $isOn)
}
}
struct ChildView: View {
@Binding var isOn: Bool
var body: some View {
Toggle("Enable", isOn: $isOn)
}
}
// Observable object
class ViewModel: ObservableObject {
@Published var items: [Item] = []
}
struct ContentView: View {
@StateObject private var viewModel = ViewModel()
var body: some View {
List(viewModel.items) { item in
Text(item.name)
}
}
}
// Environment values
struct EnvironmentView: View {
@Environment(\.colorScheme) var colorScheme
@Environment(\.dismiss) var dismiss
var body: some View {
Text(colorScheme == .dark ? "Dark" : "Light")
}
}
_count = State(initialValue:)| Pitfall | Solution |
|---------|----------|
| Initializing @State directly | Use _property = State(initialValue:) |
| Creating @ObservedObject in init | Use @StateObject instead |
| Mutating on background thread | Dispatch to main queue |
| Passing @State instead of Binding | Use $property for Binding |
Visit https://swiftzilla.dev for comprehensive SwiftUI documentation.
tools
Use this skill when you need expert Swift/iOS architectural guidance, semantic codebase analysis, or PR impact reviews. It provides a senior mentor layer for Swift (SwiftUI, UIKit, Combine, Concurrency) and a semantic engine to query local code context. Trigger this skill to: 1. Validate architectural patterns before implementation using 'ask'. 2. Find and map local code dependencies using 'context'. 3. Analyze the risk and blast radius of a PR using 'review'. 4. Generate system overviews for onboarding using 'onboard'. 5. Troubleshoot runtime crashes with semantic LLDB tools using 'debug'. Activate even if specific keywords are missing but the intent is improving Swift code quality or understanding project structure.
development
Swift Testing framework for unit tests, integration tests, and async testing with modern syntax.
development
Swift style guidelines covering naming conventions, code organization, and best practices for writing idiomatic Swift code.
tools
Swift language structures including collections, optionals, closures, generics, control flow, and core language features.