1---
2name: ios-application-dev
3description: |
4 iOS application development guide covering UIKit, SnapKit, and SwiftUI. Includes touch targets, safe areas, navigation patterns, Dynamic Type, Dark Mode, accessibility, collection views, common UI components, and SwiftUI design guidelines. For detailed references on specific topics, see the reference files.
5 Use when: developing iOS apps, implementing UI, reviewing iOS code, working with UIKit/SnapKit/SwiftUI layouts, building iPhone interfaces, Swift mobile development, Apple HIG compliance, iOS accessibility implementation.
6description_zh: "iOS 应用开发指南"
7description_en: "iOS development guide (UIKit, SnapKit, SwiftUI)"
8license: MIT
9metadata:
10 source: https://skillmd.com/skills/infometa/ios-application-dev
11 author: MiniMax-OpenSource
12 version: "1.0.0"
13 category: mobile
14 sources:
15 - Apple Human Interface Guidelines
16 - Apple Developer Documentation
17display_name: "ios-application-dev"
18display_name_en: "ios-application-dev"
19visibility: "public"
20---
21
22# iOS Application Development Guide
23
24A practical guide for building iOS applications using UIKit, SnapKit, and SwiftUI. Focuses on proven patterns and Apple platform conventions.
25
26## Quick Reference
27
28### UIKit
29
30| Purpose | Component |
31|---------|-----------|
32| Main sections | `UITabBarController` |
33| Drill-down | `UINavigationController` |
34| Focused task | Sheet presentation |
35| Critical choice | `UIAlertController` |
36| Secondary actions | `UIContextMenuInteraction` |
37| List content | `UICollectionView` + `DiffableDataSource` |
38| Sectioned list | `DiffableDataSource` + `headerMode` |
39| Grid layout | `UICollectionViewCompositionalLayout` |
40| Search | `UISearchController` |
41| Share | `UIActivityViewController` |
42| Location (once) | `CLLocationButton` |
43| Feedback | `UIImpactFeedbackGenerator` |
44| Linear layout | `UIStackView` |
45| Custom shapes | `CAShapeLayer` + `UIBezierPath` |
46| Gradients | `CAGradientLayer` |
47| Modern buttons | `UIButton.Configuration` |
48| Dynamic text | `UIFontMetrics` + `preferredFont` |
49| Dark mode | Semantic colors (`.systemBackground`, `.label`) |
50| Permissions | Contextual request + `AVCaptureDevice` |
51| Lifecycle | `UIApplication` notifications |
52
53### SwiftUI
54
55| Purpose | Component |
56|---------|-----------|
57| Main sections | `TabView` + `tabItem` |
58| Drill-down | `NavigationStack` + `NavigationPath` |
59| Focused task | `.sheet` + `presentationDetents` |
60| Critical choice | `.alert` |
61| Secondary actions | `.contextMenu` |
62| List content | `List` + `.insetGrouped` |
63| Search | `.searchable` |
64| Share | `ShareLink` |
65| Location (once) | `LocationButton` |
66| Feedback | `UIImpactFeedbackGenerator` |
67| Progress (known) | `ProgressView(value:total:)` |
68| Progress (unknown) | `ProgressView()` |
69| Dynamic text | `.font(.body)` semantic styles |
70| Dark mode | `.primary`, `.secondary`, `Color(.systemBackground)` |
71| Scene lifecycle | `@Environment(\.scenePhase)` |
72| Reduce motion | `@Environment(\.accessibilityReduceMotion)` |
73| Dynamic type | `@Environment(\.dynamicTypeSize)` |
74
75## Core Principles
76
77### Layout
78- Touch targets >= 44pt
79- Content within safe areas (SwiftUI respects by default, use `.ignoresSafeArea()` only for backgrounds)
80- Use 8pt spacing increments (8, 16, 24, 32, 40, 48)
81- Primary actions in thumb zone
82- Support all screen sizes (iPhone SE 375pt to Pro Max 430pt)
83
84### Typography
85- UIKit: `preferredFont(forTextStyle:)` + `adjustsFontForContentSizeCategory = true`
86- SwiftUI: semantic text styles `.headline`, `.body`, `.caption`
87- Custom fonts: `UIFontMetrics` / `Font.custom(_:size:relativeTo:)`
88- Adapt layout at accessibility sizes (minimum 11pt)
89
90### Colors
91- Use semantic system colors (`.systemBackground`, `.label`, `.primary`, `.secondary`)
92- Asset catalog variants for custom colors (Any/Dark Appearance)
93- No color-only information (pair with icons or text)
94- Contrast ratio >= 4.5:1 for normal text, 3:1 for large text
95
96### Accessibility
97- Labels on icon buttons (`.accessibilityLabel()`)
98- Reduce motion respected (`@Environment(\.accessibilityReduceMotion)`)
99- Logical reading order (`.accessibilitySortPriority()`)
100- Support Bold Text, Increase Contrast preferences
101
102### Navigation
103- Tab bar (3-5 sections) stays visible during navigation
104- Back swipe works (never override system gestures)
105- State preserved across tabs (`@SceneStorage`, `@State`)
106- Never use hamburger menus
107
108### Privacy & Permissions
109- Request permissions in context (not at launch)
110- Custom explanation before system dialog
111- Support Sign in with Apple
112- Respect ATT denial
113
114## Checklist
115
116### Layout
117- [ ] Touch targets >= 44pt
118- [ ] Content within safe areas
119- [ ] Primary actions in thumb zone (bottom half)
120- [ ] Flexible widths for all screen sizes (SE to Pro Max)
121- [ ] Spacing aligns to 8pt grid
122
123### Typography
124- [ ] Semantic text styles or UIFontMetrics-scaled custom fonts
125- [ ] Dynamic Type supported up to accessibility sizes
126- [ ] Layouts reflow at large sizes (no truncation)
127- [ ] Minimum text size 11pt
128
129### Colors
130- [ ] Semantic system colors or light/dark asset variants
131- [ ] Dark Mode is intentional (not just inverted)
132- [ ] No color-only information
133- [ ] Text contrast >= 4.5:1 (normal) / 3:1 (large)
134- [ ] Single accent color for interactive elements
135
136### Accessibility
137- [ ] VoiceOver labels on all interactive elements
138- [ ] Logical reading order
139- [ ] Bold Text preference respected
140- [ ] Reduce Motion disables decorative animations
141- [ ] All gestures have alternative access paths
142
143### Navigation
144- [ ] Tab bar for 3-5 top-level sections
145- [ ] No hamburger/drawer menus
146- [ ] Tab bar stays visible during navigation
147- [ ] Back swipe works throughout
148- [ ] State preserved across tabs
149
150### Components
151- [ ] Alerts for critical decisions only
152- [ ] Sheets have dismiss path (button and/or swipe)
153- [ ] List rows >= 44pt tall
154- [ ] Destructive buttons use `.destructive` role
155
156### Privacy
157- [ ] Permissions requested in context (not at launch)
158- [ ] Custom explanation before system permission dialog
159- [ ] Sign in with Apple offered with other providers
160- [ ] Basic features usable without account
161- [ ] ATT prompt shown if tracking, denial respected
162
163### System Integration
164- [ ] App handles interruptions gracefully (calls, background, Siri)
165- [ ] App content indexed for Spotlight
166- [ ] Share Sheet available for shareable content
167
168## References
169
170| Topic | Reference |
171|-------|-----------|
172| Touch Targets, Safe Area, CollectionView | [Layout System](references/layout-system.md) |
173| TabBar, NavigationController, Modal | [Navigation Patterns](references/navigation-patterns.md) |
174| StackView, Button, Alert, Search, ContextMenu | [UIKit Components](references/uikit-components.md) |
175| CAShapeLayer, CAGradientLayer, Core Animation | [Graphics & Animation](references/graphics-animation.md) |
176| Dynamic Type, Semantic Colors, VoiceOver | [Accessibility](references/accessibility.md) |
177| Permissions, Location, Share, Lifecycle, Haptics | [System Integration](references/system-integration.md) |
178| Metal Shaders & GPU | [Metal Shader Reference](references/metal-shader.md) |
179| SwiftUI HIG, Components, Patterns, Anti-Patterns | [SwiftUI Design Guidelines](references/swiftui-design-guidelines.md) |
180| Optionals, Protocols, async/await, ARC, Error Handling | [Swift Coding Standards](references/swift-coding-standards.md) |
181
182---
183
184Swift, SwiftUI, UIKit, SF Symbols, Metal, and Apple are trademarks of Apple Inc. SnapKit is a trademark of its respective owners.