Agent skill · software engineering · thebushidocollective
ios-swiftui-patterns
Use when building SwiftUI views, managing state with @State/@Binding/@ObservableObject, or implementing declarative UI patterns in iOS apps.
Why this skill is useful
Provides specific patterns and best practices for state management and UI composition in SwiftUI that the AI wouldn't reliably generate on its own.
What it needs
About 3k tokens when loaded. Last updated 2026-07-19. 187 stars on the source repository.
What this skill does
iOS - SwiftUI Patterns Modern declarative UI development for iOS, macOS, watchOS, and tvOS applications. Key Concepts State Management Hierarchy SwiftUI provides a hierarchy of property wrappers for different state needs: @State: Local view state, owned by the view @Binding: Two-way connection to state owned elsewhere @StateObject: Creates and owns an ObservableObject @ObservedObject: References an ObservableObject owned elsewhere @EnvironmentObject: Dependency injection through the view hierarchy @Environment: Access to system-provided values Observable Pattern (iOS 17+) Legacy ObservableObject Pattern Best Practices View Composition Break complex views into smaller, focused components: Prefer Value Types Use structs for models when possible to leverage SwiftUI's efficient diffing: Use ViewModifiers for Reusable Styling Task Lifecycle for Async Work Common Patterns Navigation with NavigationStack (iOS 16+) Sheet and Alert Presentation List with SwiftData (iOS 17+) Anti-Patterns Avoid Large Monolithic Views Bad: Good: Extract into focused subviews. Don't Use @ObservedObject for Owned State Bad: Good: Avoid Side Effects in View Body Bad: Good: Use .task, .onAppear, or .onChange for side effects. Don't Force Unwrap in Views Bad: Good: Related Skills ios-swift-concurrency: Async/await patterns for data loading ios-uikit-architecture: When bridging UIKit and SwiftUI
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills thebushidocollective/swiftui-patterns