name: ios-swift description: "Guides iOS app development with Swift including SwiftUI views, UIKit view controllers, navigation, async/await networking, Core Data persistence, Xcode project configuration, and App Store submission. Use when the user asks about iOS Swift development, needs to create iOS applications, implement SwiftUI or UIKit components, or configure Xcode signing and TestFlight."
Use this skill whenever the user wants to:
struct ContentView: View {
@StateObject private var viewModel = ItemViewModel()
var body: some View {
NavigationStack {
List(viewModel.items) { item in
NavigationLink(item.name) {
DetailView(item: item)
}
}
.navigationTitle("Items")
.task { await viewModel.loadItems() }
}
}
}
@MainActor
class ItemViewModel: ObservableObject {
@Published var items: [Item] = []
func loadItems() async {
let (data, _) = try await URLSession.shared.data(from: url)
items = try JSONDecoder().decode([Item].self, from: data)
}
}
let detailVC = DetailViewController()
detailVC.item = selectedItem
navigationController?.pushViewController(detailVC, animated: true)
@MainActor; use [weak self] in closures to avoid retain cycles.NSCameraUsageDescription and other privacy keys to Info.plist before requesting permissions.iOS, Swift, SwiftUI, UIKit, Xcode, async/await, Core Data, TestFlight, App Store