swiftui-architecture/SKILL.md
Design and implement SwiftUI views, components, and app architecture. Use when creating new SwiftUI views, implementing MVVM/TCA patterns, managing state with @Observable, @State, @Binding, or @Environment, designing navigation flows, or structuring iOS app architecture. Triggers on SwiftUI, view model, state management, navigation, coordinator pattern.
npx skillsauth add abanoub-ashraf/manus-skills-import swiftui-architectureInstall 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.
You are an expert iOS developer specializing in SwiftUI and modern Apple platform development. When this skill activates, help the user with SwiftUI architecture following these guidelines:
ViewBuilder for complex conditional layouts// Prefer @Observable over ObservableObject
@Observable
class ViewModel {
var items: [Item] = []
var isLoading = false
}
// Use in views
struct ContentView: View {
@State private var viewModel = ViewModel()
}
class ViewModel: ObservableObject {
@Published var items: [Item] = []
}
struct ContentView: View {
@StateObject private var viewModel = ViewModel()
}
| Wrapper | Use Case |
|---------|----------|
| @State | View-local, value types |
| @Binding | Two-way data flow from parent |
| @Environment | System or app-wide values |
| @Observable | iOS 17+ reference type models |
| @StateObject | iOS 16 and earlier, owns the object |
| @ObservedObject | iOS 16 and earlier, doesn't own |
NavigationStack (iOS 16+):
@Observable
class Router {
var path = NavigationPath()
func navigate(to destination: Destination) {
path.append(destination)
}
func popToRoot() {
path.removeLast(path.count)
}
}
Coordinator Pattern:
protocol Coordinator {
associatedtype Content: View
@ViewBuilder func start() -> Content
}
Feature/
├── Views/
│ ├── FeatureView.swift
│ └── Components/
├── ViewModels/
│ └── FeatureViewModel.swift
├── Models/
│ └── FeatureModel.swift
└── Services/
└── FeatureService.swift
@Reducer
struct Feature {
@ObservableState
struct State: Equatable { }
enum Action { }
var body: some ReducerOf<Self> {
Reduce { state, action in
// Handle actions
}
}
}
#Preview("Loading") {
ContentView(viewModel: .preview(isLoading: true))
}
#Preview("With Data") {
ContentView(viewModel: .preview(items: .mock))
}
#Preview("Error") {
ContentView(viewModel: .preview(error: .networkError))
}
extension EnvironmentValues {
@Entry var apiClient: APIClient = .live
}
.task {
await viewModel.loadData()
}
.refreshable {
await viewModel.refresh()
}
@Observable
class ViewModel {
var error: Error?
var showError: Bool { error != nil }
func loadData() async {
do {
items = try await service.fetch()
} catch {
self.error = error
}
}
}
development
Design principles for building polished, native-feeling SwiftUI apps and widgets. Use this skill when creating or modifying SwiftUI views, iOS widgets (WidgetKit), or any native Apple UI. Ensures proper spacing, typography, colors, and widget implementations that look and feel like quality apps rather than AI-generated slop.
development
Implement, review, or improve SwiftUI animations and transitions. Use when adding implicit or explicit animations with withAnimation, configuring spring animations (.smooth, .snappy, .bouncy), building phase or keyframe animations with PhaseAnimator/KeyframeAnimator, creating hero transitions with matchedGeometryEffect or matchedTransitionSource, adding SF Symbol effects (bounce, pulse, variableColor, breathe, rotate, wiggle), implementing custom Transition or CustomAnimation types, or ensuring animations respect accessibilityReduceMotion.
testing
Audit SwiftUI views for accessibility (iOS + macOS) with patch-ready fixes
devops
Implement, review, or improve data persistence using SwiftData. Use when defining @Model classes with @Attribute, @Relationship, @Transient, @Unique, or @Index; when querying with @Query, #Predicate, FetchDescriptor, or SortDescriptor; when configuring ModelContainer and ModelContext for SwiftUI or background work with @ModelActor; when planning schema migrations with VersionedSchema and SchemaMigrationPlan; when setting up CloudKit sync with ModelConfiguration; or when coexisting with or migrating from Core Data.