Skip to content

Path A (Apple Native)

Path A is the Apple Native runtime path (DeploymentPath.appleNative) for core app flows:

  • Auth: Sign in with Apple (AuthenticationServices)
  • Data: SwiftData + CloudKit-backed configuration in production
  • Payments: StoreKit 2
  • Analytics: TelemetryDeck (optional)
  • Backend exceptions: AI chat (and feedback submission) still use backend endpoints

Pick it if:

  • you want local-first iOS app flows without running full server infrastructure
  • you don’t need custom server-side business APIs yet
  • you’re fine with Apple-native constraints (CloudKit schemas, SIWA flow, StoreKit-only payments)

AppConfig.current resolves the deployment path at runtime in ios/SwiftLaunch/Core/Config/AppConfig.swift:

  1. E2E override
  2. SWIFTLAUNCH_DEPLOYMENT_PATH environment variable
  3. UserDefaults("deploymentPath")
  4. Info.plist key SWIFTLAUNCH_DEPLOYMENT_PATH
  5. .appleNative fallback

The iOS app uses AppleAuthService to:

  • request Sign in with Apple credentials
  • require both identity token and authorization code before creating a session
  • persist the session in Keychain
  • validate session by checking ASAuthorizationAppleIDProvider credential state

AuthState.configureLocalPersistenceIfNeeded(...) wires UserRepository for .appleNative so Apple-authenticated users are persisted through SwiftData.

LaunchSwiftApp injects a shared SwiftData ModelContainer with:

  • Schema(versionedSchema: SwiftLaunchSchemaV1.self)
  • ModelConfiguration("SwiftLaunch", ..., cloudKitDatabase: cloudKitDatabase(for: config))
  • migration plan SwiftLaunchMigrationPlan

Feature states attach repositories when running in .appleNative:

  • AIState -> ConversationRepository (conversation/message persistence)
  • SettingsState -> SettingsRepository (settings persistence)
  • AuthState -> UserRepository (Apple user persistence)

CloudKit capability is declared in both:

  • ios/SwiftLaunch/SwiftLaunch.entitlements
  • ios/project.yml target entitlements

CloudKit database mode is enabled only when buildEnvironment == .production and AppConfig.cloudKitContainerIdentifier is present.

  • AI chat still uses Worker endpoints (/api/chat route family) for model inference, even in .appleNative.
  • Feedback submission posts to /api/feedback.
  • Both route families are backend-auth-protected (protectedRoute middleware), so successful calls require backend-authenticated request context (or the debug x-test-user-id header used by E2E bypass builds).

Apple Native sign-in is still enough for app-shell navigation gates (AppRouter.isAuthenticated), but it does not by itself establish backend auth for those endpoints.

So Path A is best described as backend-free for core auth/persistence/settings flows, with an explicit backend exception for AI (and feedback submission when backend-auth context is available).