1---2name: ios-application-dev3description: Provides practical guidance for building iOS applications with UIKit, SnapKit, and SwiftUI, covering layout, typography, colors, accessibility, navigation, and privacy patterns.4license: MIT5---67# iOS Application Development Guide89A practical guide for building iOS applications using UIKit, SnapKit, and SwiftUI. Focuses on proven patterns and Apple platform conventions.1011## Quick Reference1213### UIKit1415| Purpose | Component |16|---------|-----------|17| Main sections | `UITabBarController` |18| Drill-down | `UINavigationController` |19| Focused task | Sheet presentation |20| Critical choice | `UIAlertController` |21| Secondary actions | `UIContextMenuInteraction` |22| List content | `UICollectionView` + `DiffableDataSource` |23| Sectioned list | `DiffableDataSource` + `headerMode` |24| Grid layout | `UICollectionViewCompositionalLayout` |25| Search | `UISearchController` |26| Share | `UIActivityViewController` |27| Location (once) | `CLLocationButton` |28| Feedback | `UIImpactFeedbackGenerator` |29| Linear layout | `UIStackView` |30| Custom shapes | `CAShapeLayer` + `UIBezierPath` |31| Gradients | `CAGradientLayer` |32| Modern buttons | `UIButton.Configuration` |33| Dynamic text | `UIFontMetrics` + `preferredFont` |34| Dark mode | Semantic colors (`.systemBackground`, `.label`) |35| Permissions | Contextual request + `AVCaptureDevice` |36| Lifecycle | `UIApplication` notifications |3738### SwiftUI3940| Purpose | Component |41|---------|-----------|42| Main sections | `TabView` + `tabItem` |43| Drill-down | `NavigationStack` + `NavigationPath` |44| Focused task | `.sheet` + `presentationDetents` |45| Critical choice | `.alert` |46| Secondary actions | `.contextMenu` |47| List content | `List` + `.insetGrouped` |48| Search | `.searchable` |49| Share | `ShareLink` |50| Location (once) | `LocationButton` |51| Feedback | `UIImpactFeedbackGenerator` |52| Progress (known) | `ProgressView(value:total:)` |53| Progress (unknown) | `ProgressView()` |54| Dynamic text | `.font(.body)` semantic styles |55| Dark mode | `.primary`, `.secondary`, `Color(.systemBackground)` |56| Scene lifecycle | `@Environment(\.scenePhase)` |57| Reduce motion | `@Environment(\.accessibilityReduceMotion)` |58| Dynamic type | `@Environment(\.dynamicTypeSize)` |5960## Core Principles6162### Layout63- Touch targets >= 44pt64- Content within safe areas (SwiftUI respects by default, use `.ignoresSafeArea()` only for backgrounds)65- Use 8pt spacing increments (8, 16, 24, 32, 40, 48)66- Primary actions in thumb zone67- Support all screen sizes (iPhone SE 375pt to Pro Max 430pt)6869### Typography70- UIKit: `preferredFont(forTextStyle:)` + `adjustsFontForContentSizeCategory = true`71- SwiftUI: semantic text styles `.headline`, `.body`, `.caption`72- Custom fonts: `UIFontMetrics` / `Font.custom(_:size:relativeTo:)`73- Adapt layout at accessibility sizes (minimum 11pt)7475### Colors76- Use semantic system colors (`.systemBackground`, `.label`, `.primary`, `.secondary`)77- Asset catalog variants for custom colors (Any/Dark Appearance)78- No color-only information (pair with icons or text)79- Contrast ratio >= 4.5:1 for normal text, 3:1 for large text8081### Accessibility82- Labels on icon buttons (`.accessibilityLabel()`)83- Reduce motion respected (`@Environment(\.accessibilityReduceMotion)`)84- Logical reading order (`.accessibilitySortPriority()`)85- Support Bold Text, Increase Contrast preferences8687### Navigation88- Tab bar (3-5 sections) stays visible during navigation89- Back swipe works (never override system gestures)90- State preserved across tabs (`@SceneStorage`, `@State`)91- Never use hamburger menus9293### Privacy & Permissions94- Request permissions in context (not at launch)95- Custom explanation before system dialog96- Support Sign in with Apple97- Respect ATT denial9899## Checklist100101### Layout102- [ ] Touch targets >= 44pt103- [ ] Content within safe areas104- [ ] Primary actions in thumb zone (bottom half)105- [ ] Flexible widths for all screen sizes (SE to Pro Max)106- [ ] Spacing aligns to 8pt grid107108### Typography109- [ ] Semantic text styles or UIFontMetrics-scaled custom fonts110- [ ] Dynamic Type supported up to accessibility sizes111- [ ] Layouts reflow at large sizes (no truncation)112- [ ] Minimum text size 11pt113114### Colors115- [ ] Semantic system colors or light/dark asset variants116- [ ] Dark Mode is intentional (not just inverted)117- [ ] No color-only information118- [ ] Text contrast >= 4.5:1 (normal) / 3:1 (large)119- [ ] Single accent color for interactive elements120121### Accessibility122- [ ] VoiceOver labels on all interactive elements123- [ ] Logical reading order124- [ ] Bold Text preference respected125- [ ] Reduce Motion disables decorative animations126- [ ] All gestures have alternative access paths127128### Navigation129- [ ] Tab bar for 3-5 top-level sections130- [ ] No hamburger/drawer menus131- [ ] Tab bar stays visible during navigation132- [ ] Back swipe works throughout133- [ ] State preserved across tabs134135### Components136- [ ] Alerts for critical decisions only137- [ ] Sheets have dismiss path (button and/or swipe)138- [ ] List rows >= 44pt tall139- [ ] Destructive buttons use `.destructive` role140141### Privacy142- [ ] Permissions requested in context (not at launch)143- [ ] Custom explanation before system permission dialog144- [ ] Sign in with Apple offered with other providers145- [ ] Basic features usable without account146- [ ] ATT prompt shown if tracking, denial respected147148### System Integration149- [ ] App handles interruptions gracefully (calls, background, Siri)150- [ ] App content indexed for Spotlight151- [ ] Share Sheet available for shareable content152153## References154155| Topic | Reference |156|-------|-----------|157| Touch Targets, Safe Area, CollectionView | [Layout System](references/layout-system.md) |158| TabBar, NavigationController, Modal | [Navigation Patterns](references/navigation-patterns.md) |159| StackView, Button, Alert, Search, ContextMenu | [UIKit Components](references/uikit-components.md) |160| CAShapeLayer, CAGradientLayer, Core Animation | [Graphics & Animation](references/graphics-animation.md) |161| Dynamic Type, Semantic Colors, VoiceOver | [Accessibility](references/accessibility.md) |162| Permissions, Location, Share, Lifecycle, Haptics | [System Integration](references/system-integration.md) |163| Metal Shaders & GPU | [Metal Shader Reference](references/metal-shader.md) |164| SwiftUI HIG, Components, Patterns, Anti-Patterns | [SwiftUI Design Guidelines](references/swiftui-design-guidelines.md) |165| Optionals, Protocols, async/await, ARC, Error Handling | [Swift Coding Standards](references/swift-coding-standards.md) |166167---168169Swift, SwiftUI, UIKit, SF Symbols, Metal, and Apple are trademarks of Apple Inc. SnapKit is a trademark of its respective owners.