The Swift Kit logoThe Swift Kit

TheSwiftKit – SwiftUI App Template Documentation

Overview

TheSwiftKit is a production‑ready SwiftUI template with modular features: onboarding, authentication, paywall/subscriptions, analytics, notifications, AI wrappers, settings, and local persistence.

Goal: clone → paste keys → set app name/colors → run. No code rewrites required for the typical setup.

Requirements

Quick Start

  1. Clone the repo and open TheSwiftKit.xcodeproj.
  2. Duplicate Config/Secrets.sample.swift to Config/Secrets.swift and fill your keys.
  3. Set your app name and branding:
    • App name: Config/AppConfig.swift
    • Theme colors: Core/Theme/DesignTokens.swift
    • Bundle ID: project.yml (or Xcode’s Signing settings)
    • App icons: Resources/Assets.xcassets/AppIcon.appiconset. Optional logo: add AppLogoimage in Assets.
  4. Build and run. If keys are missing, the app falls back to safe no‑op services.

Configuration

App config (Config/AppConfig.swift)

Secrets (Config/Secrets.swift)

Best practice: keep real secrets out of git; use local Secrets.swift.

Theme colors (Core/Theme/DesignTokens.swift)

Set primaryHex and accentHex once. UI uses DesignTokens.primaryColor and DesignTokens.accentColor.

Bundle identifier

Assets

Localization

Strings live in Resources/Base.lproj/Localizable.strings. Strings containing “APP_NAME” automatically replace with AppConfig.appName at runtime.

Feature Reference

Onboarding (3 styles)

Authentication & Profile

Paywall & Subscriptions

Analytics

Notifications (Debug)

AI Wrappers (optional)

Local Data Demo

Theming

App Shell & Routing

Backend Setup

Supabase (Auth, Profiles, Avatars)

Prerequisites:

Profile repository: iOS uses SupabaseProfileRepository to read/write profiles and upload avatars. Ensure RLS policies allow users to select/insert/update their own profile row and storage objects.

Subscriptions table + webhook mirror (optional, recommended)

RevenueCat (Paywall)

AI Backend (Flask, optional)

How The Pieces Fit

Step‑by‑Step Setup

  1. Clone the repo and open the project.
  2. Create secrets: Copy Config/Secrets.sample.swiftConfig/Secrets.swift. Fill Supabase URL/key, RevenueCat key, TelemetryDeck App ID, AI base URL, and optional account deletion endpoint.
  3. Configure app settings:
    • Edit Config/AppConfig.swift: appName, backend (.supabase or .local),onboardingStyle, featureFlags, legal URLs
    • Edit Core/Theme/DesignTokens.swift: primaryHex and accentHex
  4. Bundle ID and signing: Update project.yml PRODUCT_BUNDLE_IDENTIFIER (or via Xcode Signing & Capabilities). Select your development team and fix signing if needed.
  5. Assets: Place your icons in AppIcon.appiconset. Add an AppLogo image (optional) for a branded logo in the UI.
  6. Backend: Supabase → run the provided SQL migrations, configure RLS/policies, and set Secrets. RevenueCat → configure products/offerings and paste API key in Secrets. AI backend → run the Flask server locally or point to your hosted backend via Secrets.
  7. Build & run: In DEBUG, you can use TestDrive to quickly jump to screens or force onboarding/auth.

Enabling Sign in with Apple (Optional Later)

Currently the Sign in with Apple button is disabled visually. Once you have Apple credentials and backend wiring:

  1. Remove .disabled(true) on the button in Modules/Auth/SignInView.swift.
  2. Wire the backend adapters to handle Apple sign‑in (e.g., Supabase GoTrue Apple OAuth).

Customization Tips

Troubleshooting

Production Hardening

File Map (Edit Points)

That’s it — clone, duplicate Secrets, set AppConfig + DesignTokens, update bundle ID and assets, then run. The template adapts based on the SDKs and keys you provide, so you can start simple and layer on services when ready.