Skip to main content

Mobile (iOS)

Mobile delivery is shaped by OS versions, review, permissions, and background limits. This page focuses on Apple platforms and Swift (personal and product work). Android appears when dual-platform is required—often shared logic via KMP while UI stays native per platform.

Platform constraints

ConstraintImpact
App lifecycleShort background; state restoration, scenes
PermissionsCamera, location, notifications—timing and usage strings
DistributionApp Store review, signing, TestFlight
Device matrixScreens, Dynamic Island, accessibility, performance tiers

SwiftUI structure (default)

LayerRole
ViewDeclarative UI; keep body side-effect free
Model@Observable / value-type state
ServicesNetwork, persistence, system APIs behind protocols

Navigation: NavigationStack with type-safe routes; deep links via a single onOpenURL path.

Concurrency: UI on @MainActor; heavy work in Task; respect Sendable across actors.

tip

Preview-first: #Preview with mock services for complex views to cut device churn.

Alignment with layering

Clean roleSwift placement
DomainPure Swift types; no UIKit/SwiftUI imports
Use casesasync services coordinating repositories
AdaptersURLSession, SwiftData/Core Data, Keychain
PresentationThin SwiftUI views + view models

Flow: unidirectional—user event → use case → state snapshot → view. Views should not call SDKs directly.

See layering and boundaries.

Persistence choices

OptionWhen
UserDefaults / KeychainSettings, tokens (secrets in Keychain only)
SwiftData / Core DataStructured offline data, queries
Files / CloudKitLarge blobs, multi-device sync (plan conflicts)

Ship schema migrations with tests; run simulator UI matrices in CI.

Network and offline

  • Shared client defaults: timeouts, retries, cancellable Task
  • Lists: skeletons + pagination; retryable errors
  • Idempotent writes with client ids server-side

Release checklist

StepAction
VersionsMarketing version + monotonic build
SigningAutomatic or CI certs—no keys in git
PrivacyNutrition labels match implementation and strings
TestingTestFlight → phased release
MonitoringCrashes (MetricKit/third-party), key funnels

Pair with Git workflow: tags trigger archive/upload jobs.

Quality and accessibility

  • Dynamic Type, VoiceOver labels, adequate hit targets
  • Avoid gesture-only critical paths; provide visible controls
  • Profile with Instruments for main-thread hangs and excess SwiftUI body work