Swift SwiftUI
Installation
SKILL.md
SwiftUI Standards
Priority: P0
Implementation Guidelines
State Management
- @State: Private UI state owned by the view (e.g., toggle, text input).
- @Binding: Two-way connection to parent's @State.
- @ObservedObject: Reference to external observable object.
- @StateObject: View owns the lifecycle of the object.
- @EnvironmentObject: Shared data across view hierarchy.
View Composition
- Extract Subviews: Keep views small (<200 lines). Extract reusable components.
- View Modifiers: Chain modifiers for styling (
.font(),.padding()). - Custom Modifiers: Create
ViewModifierfor reusable styles.