Comprehensive iOS development guidance covering SwiftUI, Swift Concurrency, Core Data, and Swift Testing
You are an iOS development expert. This skill aggregates best practices from specialized agent skills for comprehensive iOS app development.
| Need | Reference | |------|-----------| | SwiftUI views, state, modern APIs | → swiftui.md | | What's new in SwiftUI by iOS version | → whats-new-swiftui/ | | What's new in Swift by version | → whats-new-swift/ | | async/await, actors, Sendable | → swift-concurrency.md | | Core Data persistence, threading | → core-data.md | | Swift Testing, migration from XCTest | → swift-testing.md | | General Swift patterns and practices | → swift.md |
@Observable over ObservableObject, NavigationStack over NavigationView@MainActor and custom actors for thread safetyTask.detached when possibleNSManagedObject across Core Data contexts#expect and #require over XCTest assertions@Observable
@MainActor
final class ViewModel {
var items: [Item] = []
func load() async {
items = await fetchItems()
}
}
struct ContentView: View {
@State private var viewModel = ViewModel()
var body: some View {
List(viewModel.items) { item in
Text(item.name)
}
.task {
await viewModel.load()
}
}
}
// Structured concurrency with task group
func fetchAllData() async throws -> [Data] {
try await withThrowingTaskGroup(of: Data.self) { group in
for url in urls {
group.addTask { try await fetch(url) }
}
return try await group.reduce(into: []) { $0.append($1) }
}
}
// Actor for shared state
actor DataStore {
private var cache: [String: Data] = [:]
func get(_ key: String) -> Data? { cache[key] }
func set(_ key: String, _ value: Data) { cache[key] = value }
}
// Safe background processing
func importData(_ items: [ImportItem]) async throws {
let context = container.newBackgroundContext()
try await context.perform {
for item in items {
let entity = Entity(context: context)
entity.configure(from: item)
}
try context.save()
}
}
// Pass IDs, not objects
let objectID = managedObject.objectID
Task.detached {
let context = container.newBackgroundContext()
let object = try context.existingObject(with: objectID)
// Work with object safely
}
import Testing
@Test("User login succeeds with valid credentials")
func loginSuccess() async throws {
let auth = AuthService()
let user = try #require(await auth.login(email: "test@example.com", password: "valid"))
#expect(user.isAuthenticated)
}
@Test(arguments: ["admin", "user", "guest"])
func rolePermissions(role: String) {
let permissions = Permissions(role: role)
#expect(permissions.canRead)
}
For more reference, use these open-source agent skills and documentation services:
developer.apple.com with sosumi.ai in URLs (e.g., https://sosumi.ai/documentation/swiftui/view)https://sosumi.ai/mcp with tools: searchAppleDocumentation, fetchAppleDocumentation, fetchAppleVideoTranscriptSearch for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer