From swift-modern-dev
Use when writing Swift or SwiftUI code, designing iOS/macOS architecture, modernizing legacy patterns, or choosing ViewModels, SwiftData, navigation, or concurrency APIs.
How this skill is triggered — by the user, by Claude, or both
Slash command
/swift-modern-dev:swift-modern-architectureThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Baseline:** Swift 6.2, SwiftUI, Observation, SwiftData, and Swift Testing. Confirm deployment targets against the project requirements.
Baseline: Swift 6.2, SwiftUI, Observation, SwiftData, and Swift Testing. Confirm deployment targets against the project requirements.
| ALWAYS | NEVER |
|---|---|
@Observable ViewModels | ObservableObject / @Published / @StateObject |
async/await, actor, @MainActor | DispatchQueue.main for UI work |
NavigationStack / NavigationSplitView | NavigationView |
SwiftData @Model / @Query | Core Data for new code |
| Swift Testing for new tests | XCTest for new tests |
| Strict concurrency | Completion handlers when async exists |
@Observable + @State / @EnvironmentactorNavigationStack + typed destinations@Observable
final class ItemsViewModel {
private let service: ItemsService
private(set) var items: [Item] = []
private(set) var isLoading = false
init(service: ItemsService) {
self.service = service
}
func load() async {
isLoading = true
defer { isLoading = false }
items = (try? await service.fetchItems()) ?? []
}
}
struct ItemsView: View {
@State private var viewModel: ItemsViewModel
var body: some View {
List(viewModel.items) { item in
Text(item.name)
}
.task { await viewModel.load() }
}
}
actor ItemsService {
func fetchItems() async throws -> [Item] {
let (data, _) = try await URLSession.shared.data(from: endpoint)
return try JSONDecoder().decode([Item].self, from: data)
}
}
import Testing
@Test("loads items")
func loadsItems() async {
let vm = ItemsViewModel(service: MockItemsService())
await vm.load()
#expect(!vm.items.isEmpty)
}
| When | Read |
|---|---|
| Full anti-pattern catalog | references/anti-patterns.md or skill swift-anti-pattern-guard |
| New app bootstrap | swift-app-scaffold |
| Test boilerplate | swift-test-scaffold |
| Reusable cross-target code | Extract a focused package or module |
npx claudepluginhub pstuart/pstuart --plugin swift-modern-devGuides iOS app architecture using Swift 6, iOS 18+, SwiftUI, SwiftData, Observation framework, and concurrency. Modernizes legacy patterns like Core Data, ObservableObject, and GCD.
Provides expert Swift and SwiftUI guidance for iOS/macOS development using iOS 17+ patterns like @Observable, MVVM/TCA architecture, property wrappers, and production-ready code.
Guides pure SwiftUI architecture: state management with @State/@Observable/@Environment, shared services, navigation, UI components, async patterns without ViewModels.