Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Design iOS mobile app UI/UX following Apple Human Interface Guidelines and SwiftUI/UIKit patterns.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: mobile-ios-design3description: Master iOS Human Interface Guidelines and SwiftUI patterns for building native iOS apps. Use when designing iOS interfaces, implementing SwiftUI views, or ensuring apps follow Apple's design principles.4---56# iOS Mobile Design78Master iOS Human Interface Guidelines (HIG) and SwiftUI patterns to build polished, native iOS applications that feel at home on Apple platforms.910## When to Use This Skill1112- Designing iOS app interfaces following Apple HIG13- Building SwiftUI views and layouts14- Implementing iOS navigation patterns (NavigationStack, TabView, sheets)15- Creating adaptive layouts for iPhone and iPad16- Using SF Symbols and system typography17- Building accessible iOS interfaces18- Implementing iOS-specific gestures and interactions19- Designing for Dynamic Type and Dark Mode2021## Core Concepts2223### 1. Human Interface Guidelines Principles2425**Clarity**: Content is legible, icons are precise, adornments are subtle26**Deference**: UI helps users understand content without competing with it27**Depth**: Visual layers and motion convey hierarchy and enable navigation2829**Platform Considerations:**3031- **iOS**: Touch-first, compact displays, portrait orientation32- **iPadOS**: Larger canvas, multitasking, pointer support33- **visionOS**: Spatial computing, eye/hand input3435### 2. SwiftUI Layout System3637**Stack-Based Layouts:**3839```swift40// Vertical stack with alignment41VStack(alignment: .leading, spacing: 12) {42Text("Title")43.font(.headline)44Text("Subtitle")45.font(.subheadline)46.foregroundStyle(.secondary)47}4849// Horizontal stack with flexible spacing50HStack {51Image(systemName: "star.fill")52Text("Featured")53Spacer()54Text("View All")55.foregroundStyle(.blue)56}57```5859**Grid Layouts:**6061```swift62// Adaptive grid that fills available width63LazyVGrid(columns: [64GridItem(.adaptive(minimum: 150, maximum: 200))65], spacing: 16) {66ForEach(items) { item in67ItemCard(item: item)68}69}7071// Fixed column grid72LazyVGrid(columns: [73GridItem(.flexible()),74GridItem(.flexible()),75GridItem(.flexible())76], spacing: 12) {77ForEach(items) { item in78ItemThumbnail(item: item)79}80}81```8283### 3. Navigation Patterns8485**NavigationStack (iOS 16+):**8687```swift88struct ContentView: View {89@State private var path = NavigationPath()9091var body: some View {92NavigationStack(path: $path) {93List(items) { item in94NavigationLink(value: item) {95ItemRow(item: item)96}97}98.navigationTitle("Items")99.navigationDestination(for: Item.self) { item in100ItemDetailView(item: item)101}102}103}104}105```106107**TabView (iOS 18+):**108109```swift110struct MainTabView: View {111@State private var selectedTab = 0112113var body: some View {114TabView(selection: $selectedTab) {115Tab("Home", systemImage: "house", value: 0) {116HomeView()117}118119Tab("Search", systemImage: "magnifyingglass", value: 1) {120SearchView()121}122123Tab("Profile", systemImage: "person", value: 2) {124ProfileView()125}126}127}128}129```130131### 4. System Integration132133**SF Symbols:**134135```swift136// Basic symbol137Image(systemName: "heart.fill")138.foregroundStyle(.red)139140// Symbol with rendering mode141Image(systemName: "cloud.sun.fill")142.symbolRenderingMode(.multicolor)143144// Variable symbol (iOS 16+)145Image(systemName: "speaker.wave.3.fill", variableValue: volume)146147// Symbol effect (iOS 17+)148Image(systemName: "bell.fill")149.symbolEffect(.bounce, value: notificationCount)150```151152**Dynamic Type:**153154```swift155// Use semantic fonts156Text("Headline")157.font(.headline)158159Text("Body text that scales with user preferences")160.font(.body)161162// Custom font that respects Dynamic Type163Text("Custom")164.font(.custom("Avenir", size: 17, relativeTo: .body))165```166167### 5. Visual Design168169**Colors and Materials:**170171```swift172// Semantic colors that adapt to light/dark mode173Text("Primary")174.foregroundStyle(.primary)175Text("Secondary")176.foregroundStyle(.secondary)177178// System materials for blur effects179Rectangle()180.fill(.ultraThinMaterial)181.frame(height: 100)182183// Vibrant materials for overlays184Text("Overlay")185.padding()186.background(.regularMaterial, in: RoundedRectangle(cornerRadius: 12))187```188189**Shadows and Depth:**190191```swift192// Standard card shadow193RoundedRectangle(cornerRadius: 16)194.fill(.background)195.shadow(color: .black.opacity(0.1), radius: 8, y: 4)196197// Elevated appearance198.shadow(radius: 2, y: 1)199.shadow(radius: 8, y: 4)200```201202## Quick Start Component203204```swift205import SwiftUI206207struct FeatureCard: View {208let title: String209let description: String210let systemImage: String211212var body: some View {213HStack(spacing: 16) {214Image(systemName: systemImage)215.font(.title)216.foregroundStyle(.blue)217.frame(width: 44, height: 44)218.background(.blue.opacity(0.1), in: Circle())219220VStack(alignment: .leading, spacing: 4) {221Text(title)222.font(.headline)223Text(description)224.font(.subheadline)225.foregroundStyle(.secondary)226.lineLimit(2)227}228229Spacer()230231Image(systemName: "chevron.right")232.foregroundStyle(.tertiary)233}234.padding()235.background(.background, in: RoundedRectangle(cornerRadius: 12))236.shadow(color: .black.opacity(0.05), radius: 4, y: 2)237}238}239```240241## Best Practices2422431. **Use Semantic Colors**: Always use `.primary`, `.secondary`, `.background` for automatic light/dark mode support2442. **Embrace SF Symbols**: Use system symbols for consistency and automatic accessibility2453. **Support Dynamic Type**: Use semantic fonts (`.body`, `.headline`) instead of fixed sizes2464. **Add Accessibility**: Include `.accessibilityLabel()` and `.accessibilityHint()` modifiers2475. **Use Safe Areas**: Respect `safeAreaInset` and avoid hardcoded padding at screen edges2486. **Implement State Restoration**: Use `@SceneStorage` for preserving user state2497. **Support iPad Multitasking**: Design for split view and slide over2508. **Test on Device**: Simulator doesn't capture full haptic and performance experience251252## Common Issues253254- **Layout Breaking**: Use `.fixedSize()` sparingly; prefer flexible layouts255- **Performance Issues**: Use `LazyVStack`/`LazyHStack` for long scrolling lists256- **Navigation Bugs**: Ensure `NavigationLink` values are `Hashable`257- **Dark Mode Problems**: Avoid hardcoded colors; use semantic or asset catalog colors258- **Accessibility Failures**: Test with VoiceOver enabled259- **Memory Leaks**: Watch for strong reference cycles in closures260