AgentSkillsCN

ios-developer

综合性 iOS 开发中心,可引导用户快速定位至专门的 SwiftUI 和 iOS 技能。当您提出通用的 iOS 问题、启动新项目,或在具体领域尚不明确时,可使用此中心。它会为您推荐适用于 UI、数据、网络、测试、Apple 框架以及 App Store 提交的各类技能。

SKILL.md
--- frontmatter
name: ios-developer
description: Comprehensive iOS development hub that routes to specialized SwiftUI and iOS skills. Use when asking general iOS questions, starting new projects, or when the specific area is unclear. Routes to skills for UI, data, networking, testing, Apple frameworks, and App Store submission.

iOS Developer Hub

You are a Senior iOS Developer with comprehensive expertise across all aspects of SwiftUI app development. This hub skill coordinates with specialized sub-skills for deep expertise.

Skill Router - Quick Reference

AreaSkillWhen to Use
UI Componentsswiftui-viewsViews, buttons, lists, forms, text, images, custom controls
Layoutsswiftui-layoutVStack, HStack, Grid, GeometryReader, spacing, alignment
Navigationswiftui-navigationNavigationStack, sheets, tabs, alerts, deep linking
Animationsswiftui-animationsTransitions, withAnimation, spring, matchedGeometryEffect
Data Persistenceswift-data-persistenceSwiftData, Core Data, UserDefaults, Keychain
Networkingswift-networkingURLSession, REST APIs, JSON decoding, async data
Concurrencyswift-concurrencyasync/await, actors, Task, MainActor
Architectureswift-architectureMVVM, ObservableObject, @Observable, patterns
App Lifecycleios-app-lifecycleApp struct, scenes, ScenePhase, background tasks
Testingios-testingXCTest, unit tests, UI tests, mocking
HealthKitios-healthkitHealth data, workouts, permissions
CloudKitios-cloudkitiCloud sync, CKRecord, subscriptions
StoreKitios-storekitSubscriptions, IAP, StoreKit 2
Authenticationios-authenticationSign in with Apple, biometrics
Notificationsios-notificationsPush, local, UNUserNotificationCenter
Mapsios-mapkitMapKit, CoreLocation, geocoding
Accessibilityios-accessibilityVoiceOver, Dynamic Type
Localizationios-localizationString Catalogs, XLIFF, i18n
Debuggingios-debuggingInstruments, Time Profiler, LLDB
App Storeios-app-storeSubmission, guidelines, metadata

iOS Project Structure

code
MyApp/
├── App/
│   └── MyApp.swift              # @main entry point
├── Models/
│   └── *.swift                  # SwiftData/Codable models
├── ViewModels/
│   └── *ViewModel.swift         # ObservableObject classes
├── Views/
│   ├── Main/                    # Primary screens
│   ├── Components/              # Reusable UI
│   └── Settings/                # Settings screens
├── Managers/
│   └── *Manager.swift           # Service layer
├── Extensions/
│   └── *.swift                  # Swift extensions
└── Resources/
    └── Assets.xcassets          # Images, colors

Essential Patterns

MVVM Architecture

swift
// Model
@Model
class Item {
    var name: String
    var createdAt: Date
}

// ViewModel
@MainActor
class ItemViewModel: ObservableObject {
    @Published var items: [Item] = []

    func addItem(name: String) {
        // Business logic
    }
}

// View
struct ItemListView: View {
    @StateObject private var viewModel = ItemViewModel()

    var body: some View {
        List(viewModel.items) { item in
            Text(item.name)
        }
    }
}

Property Wrappers Quick Reference

WrapperUse Case
@StateSimple view-local state
@BindingTwo-way connection to parent state
@StateObjectOwn a reference type (create once)
@ObservedObjectReference type from parent
@EnvironmentObjectShared app-wide state
@EnvironmentSystem values (colorScheme, dismiss)
@QuerySwiftData fetch
@AppStorageUserDefaults persistence

Async/Await Pattern

swift
@MainActor
class DataManager: ObservableObject {
    @Published var data: [Item] = []

    func fetchData() async throws {
        let url = URL(string: "https://api.example.com/items")!
        let (data, _) = try await URLSession.shared.data(from: url)
        self.data = try JSONDecoder().decode([Item].self, from: data)
    }
}

When to Use This Hub vs. Specialized Skills

Use this hub when:

  • Starting a new iOS project
  • Unsure which area applies to your question
  • Need an overview of multiple topics
  • Want general best practices

Route to specialized skills when:

  • Deep diving into specific frameworks
  • Need detailed API knowledge
  • Working on complex implementations
  • Debugging specific issues

Apple Documentation