HomeDocumentation

Documentation

Everything you need to go from clone to App Store — for both The Swift Kit and Swift Kit Pro. Follow the quick start to ship your first build in under 5 minutes.

Quick Start

Get your first build running in under 5 minutes. TheSwiftKit is designed to work out of the box — clone, configure a few values, and hit Run.

5-minute setup. Most developers ship their first build in a single coffee break.

Prerequisites

Xcode 15+

Latest stable recommended

iOS 16+

Deployment target

Swift 5.9+

Ships with Xcode 15

Setup Steps

1

Clone the repository

Clone the repo and open TheSwiftKit.xcodeproj in Xcode.

Terminalbash
git clone https://github.com/your-username/TheSwiftKit.git
cd TheSwiftKit
open TheSwiftKit.xcodeproj
2

Run the setup script

The setup script creates your Secrets.swift file from the sample and installs any dependencies.

Terminalbash
./setup.sh
3

Add your API keys

Open Config/Secrets.swift and paste your keys. You only need Supabase credentials to start — everything else is optional.

Config/Secrets.swiftswift
enum Secrets {
    static let supabaseURL       = "https://your-project.supabase.co"
    static let supabaseAnonKey   = "eyJ..."
    static let revenueCatAPIKey  = "appl_..."       // optional
    static let telemetryDeckID   = "..."            // optional
}
4

Build and run

Select your simulator or device in Xcode and press Cmd + R. The app adapts automatically based on which keys you provide — missing services fall back to safe no-op implementations.


Project Structure

TheSwiftKit follows MVVM with dependency injection. Every module is self-contained so you can add, remove, or swap features without touching unrelated code.

Folder Layouttext
TheSwiftKit/
├── Config/             # AppConfig, Secrets, FeatureFlags
├── Core/
│   ├── DI/             # Dependency injection container
│   ├── Root/           # App entry point, RootView
│   ├── Routing/        # AppRouter with typed routes
│   ├── Theme/          # DesignTokens, AppTheme
│   ├── Services/       # PurchasesService, AIApiClient
│   ├── Analytics/      # AnalyticsService (TelemetryDeck)
│   ├── Notifications/  # NotificationService
│   ├── Logging/        # AppLogger
│   └── Utils/          # AppEvents, extensions
├── Modules/
│   ├── Onboarding/     # 3 onboarding templates
│   ├── Auth/           # SignInView, auth flows
│   ├── Profile/        # ProfileSetupView, avatar upload
│   ├── Paywall/        # PaywallView, subscription UI
│   ├── Demo/           # TestDrive, LocalDataDemo
│   └── Notifications/  # NotificationsDebugView
├── Backend/
│   ├── Protocols/      # Repository protocols
│   ├── Supabase/       # Supabase implementations + SQL
│   └── Python/         # Flask AI backend
└── Resources/          # Assets, Localizable.strings
Config/App-wide settings, API keys, and feature toggles. The single source of truth for branding and behavior.
Core/Shared infrastructure: DI container, routing, theming, services, analytics, and utilities.
Modules/Feature modules (onboarding, auth, paywall, etc.). Each module owns its views and view models.
Backend/Repository implementations for Supabase, local fallbacks, and the optional Flask AI server.
Resources/Asset catalogs, app icons, and localized strings.

Configuration

Three files control your entire app. Change a value, rebuild, and see the result immediately — no code rewrites required.

AppConfig.swift

The central configuration hub. Set your app name, backend mode, onboarding style, and feature flags in one place.

Config/AppConfig.swiftswift
struct AppConfig {
    static let appName         = "MyApp"
    static let backend: Backend = .supabase   // .supabase or .local
    static let onboardingStyle = .carousel    // .carousel, .highlights, .minimal
    static let layout: HomeLayout = .grid     // .grid or .list

    struct FeatureFlags {
        static let onboarding     = true
        static let authentication = true
        static let paywall        = true
        static let notifications  = true
    }

    struct Legal {
        static let privacyURL = "https://yourapp.com/privacy"
        static let termsURL   = "https://yourapp.com/terms"
    }
}

FeatureFlags

Toggle entire modules on or off. Disabled features are completely excluded from the app flow — no leftover screens or broken navigation.

Just flip a boolean. Set FeatureFlags.paywall = false and the paywall screen disappears from the entire app flow. No other changes needed.

Secrets.swift

Your API keys live here. This file is gitignored by default — duplicate from Secrets.sample.swift and fill in your values.

Config/Secrets.swiftswift
enum Secrets {
    static let supabaseURL            = "https://xxxxx.supabase.co"
    static let supabaseAnonKey        = "eyJ..."
    static let revenueCatAPIKey       = "appl_..."
    static let telemetryDeckAppID     = "..."
    static let aiBackendBaseURLString = "http://127.0.0.1:5001"
}
Missing keys are handled gracefully. The DI container automatically falls back to no-op service implementations, so the app never crashes from a missing API key.

Authentication

Pre-built authentication powered by Supabase with email/password and Sign in with Apple. Session management, profile setup, and avatar uploads are all included.

Email / Password with Supabase

Auth is handled through the AuthRepository protocol. The DI container selects the Supabase implementation when AppConfig.backend == .supabase.

Backend/Supabase/SupabaseAuthRepository.swiftswift
// Sign up and sign in are one-liners:
let session = try await supabase.auth.signUp(
    email: email,
    password: password
)

// Session is persisted automatically.
// Profile setup sheet appears after first sign-in.

Sign in with Apple

The Sign in with Apple button is included in SignInView and ready to enable. Follow these steps:

1

Enable the capability

In Xcode, go to Signing & Capabilities and add Sign in with Apple.
2

Configure Supabase

Enable Apple as a provider in your Supabase dashboard under Authentication > Providers.
3

Remove the disabled flag

In Modules/Auth/SignInView.swift, remove the .disabled(true) modifier from the Apple button.

Customizing the Auth Flow

The auth flow is driven by feature flags. If FeatureFlags.authentication is false, the sign-in screen is skipped entirely and the app launches directly into the main experience.

Core/Root/RootView.swiftswift
// Auth flow is automatic:
// 1. Onboarding (if enabled & not completed)
// 2. Sign In (if enabled & not authenticated)
// 3. Profile Setup (if profile is incomplete)
// 4. Main App

Onboarding Templates

Three production-ready onboarding styles. Switch between them with a single config change.

Carousel

.carousel

Swipeable pages with smooth transitions. Best for visual storytelling.

Highlights

.highlights

Feature-focused cards with bold typography. Great for listing key benefits.

Minimal

.minimal

Single-screen with a CTA. Fastest path to your app for returning users.

Switching Styles

Config/AppConfig.swiftswift
// Change this one line to switch onboarding:
static let onboardingStyle = .highlights  // .carousel, .highlights, .minimal

Customizing Content

Edit the onboarding pages in Modules/Onboarding/OnboardingModels.swift. The __APP_NAME__ token is automatically replaced with your app name at runtime.

Modules/Onboarding/OnboardingModels.swiftswift
static let defaultPages: [OnboardingPage] = [
    .init(
        title: "Welcome to __APP_NAME__",
        subtitle: "Your personal AI assistant",
        systemImage: "sparkles"
    ),
    .init(
        title: "Smart & Private",
        subtitle: "Your data stays on your device",
        systemImage: "lock.shield"
    ),
    .init(
        title: "Ready to Go",
        subtitle: "Set up in seconds",
        systemImage: "rocket"
    )
]

Paywalls & Subscriptions

RevenueCat-powered subscriptions with a beautiful paywall template. StoreKit 2 integration is handled automatically.

RevenueCat Setup

1

Create products in App Store Connect

Set up your subscription products and add them to a subscription group.
2

Configure RevenueCat

Create products and offerings in the RevenueCat dashboard. Align package identifiers to your App Store products.
3

Add your API key

Paste your RevenueCat public API key in Secrets.swift:

Config/Secrets.swiftswift
static let revenueCatAPIKey = "appl_YourKeyHere"

Paywall Customization

The paywall UI lives in Modules/Paywall/PaywallView.swift. Modify the layout, copy, and styling to match your brand. The subscription logic is completely separate in PurchasesService.

Modules/Paywall/PaywallView.swiftswift
// The paywall shows automatically when no active entitlement
// is detected. Customize the UI here — the business logic
// is handled by PurchasesService.

struct PaywallView: View {
    @StateObject private var vm = PaywallViewModel()

    var body: some View {
        VStack(spacing: 24) {
            // Hero section
            // Package options (monthly, yearly)
            // Purchase button
            // Restore purchases link
        }
    }
}

Subscription Management

The Settings screen includes restore purchases, manage subscriptions (deep links to App Store), and displays the current plan and expiry date. All powered by RevenueCat's customer info.


AI Features

Three AI capabilities are built in: text chat, image generation, and vision analysis. All powered by a lightweight Flask backend that proxies OpenAI.

Chat

Conversational AI with streaming responses. Uses GPT-4 via your backend.

Image Generation

Generate images from text prompts using DALL-E. Results displayed inline.

Vision

Analyze images with GPT-4 Vision. Upload or capture photos for AI analysis.

Backend Setup (Flask)

The iOS app communicates with a Python Flask server that wraps the OpenAI API. This keeps your API key off the device.

Terminalbash
# Install dependencies
pip install -r Backend/Python/requirements.txt

# Set your OpenAI key
export OPENAI_API_KEY="sk-..."

# Start the server
python Backend/Python/app.py

# Verify it's running
curl http://127.0.0.1:5001/health
# => { "ok": true }
Config/Secrets.swiftswift
// Point the iOS app to your backend:
static let aiBackendBaseURLString = "http://127.0.0.1:5001"

// Info.plist includes ATS exceptions for localhost during dev.
// For production, use an HTTPS URL.
The AI features are fully optional. If aiBackendBaseURLString is empty or unreachable, the AI tabs gracefully show an unavailable state.

Analytics & Notifications

TelemetryDeck Setup

Privacy-first analytics powered by TelemetryDeck. Just add your App ID and events are tracked automatically.

Config/Secrets.swiftswift
static let telemetryDeckAppID = "YOUR_APP_ID"

// That's it. The AnalyticsService initializes automatically
// when this key is present.
Core/Analytics/AnalyticsService.swiftswift
// Track custom events anywhere in your app:
AnalyticsService.shared.track("subscription_started", properties: [
    "plan": "yearly",
    "source": "paywall"
])

Push Notifications

Request permissions, register for remote notifications, and schedule local notifications — all pre-wired through NotificationService.

Core/Notifications/NotificationService.swiftswift
// Request push notification permissions:
NotificationService.shared.requestPermission()

// Schedule a local notification:
NotificationService.shared.scheduleLocal(
    title: "Time to check in!",
    body: "Open the app to see what's new.",
    delay: 3600  // 1 hour from now
)

Debug View

NotificationsDebugView gives you a test harness for permissions, local scheduling, remote registration, and viewing your APNs token — all accessible in DEBUG builds.


Theming & Design Tokens

Customize your entire app's look with two hex values. The design token system propagates your brand colors to every screen.

Color Customization

Core/Theme/DesignTokens.swiftswift
struct DesignTokens {
    // Change these two values to re-brand the entire app:
    static let primaryHex = "#8A2BE2"   // Purple
    static let accentHex  = "#FF8A00"   // Orange

    // Computed colors used throughout the app:
    static var primaryColor: Color { Color(hex: primaryHex) }
    static var accentColor: Color  { Color(hex: accentHex) }
}
Two hex values. Change primaryHex and accentHex and the entire app updates — buttons, accents, gradients, tints, everything.

Custom Fonts

Add your custom fonts to Resources/ and register them in Info.plist. Then reference them in Theme.swift to apply globally via the environment.

App Theme System

AppTheme is injected via the SwiftUI environment. It supports standard and glass styles, letting you switch the entire visual language of your app.

Core/Theme/Theme.swiftswift
// Access the theme anywhere in your views:
@Environment(\.appTheme) var theme

// The theme provides consistent styling:
Text("Hello")
    .foregroundColor(theme.primaryColor)
    .font(theme.headlineFont)

// Toggle glass style for a frosted-glass aesthetic:
AppTheme(style: .glass)

Deployment

When you're ready to ship, follow this checklist to go from development build to the App Store.

TestFlight Setup

1

Archive your build

In Xcode, select Product > Archive. Make sure you are building for Any iOS Device (not a simulator).
2

Upload to App Store Connect

In the Organizer, click Distribute App and follow the prompts to upload to App Store Connect.
3

Add testers

In App Store Connect, go to your app's TestFlight tab and add internal or external testers.

App Store Submission Checklist

1
Bundle identifier matches App Store Connect
2
App icons are set for all sizes
3
Privacy Policy and Terms URLs are live
4
Remove or guard debug/test screens (TestDrive is DEBUG-only by default)
5
RevenueCat products are in "Ready to Submit" status
6
Push notification entitlement matches your provisioning profile
7
Screenshots and metadata are uploaded in App Store Connect

Production Hardening

Before submitting, ensure these production-specific items are handled:

  • Replace placeholder legal URLs with your real Privacy Policy and Terms of Service.
  • Confirm Secrets.swift is gitignored and not included in your repository.
  • Switch AI backend URL from localhost to your production HTTPS endpoint.
  • Tighten Supabase RLS policies and consider using signed URLs for storage buckets.
  • Set up CI/CD with secure environment variables for API keys.
From clone to App Store. TheSwiftKit is built to get you from first build to App Store submission in days, not months.

Pro tier

Swift Kit Pro

Swift Kit Pro is a superset of The Swift Kit. You get the entire core boilerplate — auth, paywalls, AI, onboarding, analytics, theming — plus 13 advanced production features that real apps ship with, and a 1:1 onboarding call where we set it up with you.

The Pro rule: every feature is one flag to disable, one folder to delete. Keep what you need, remove the rest — the app still builds.
The Swift Kit Pro

Everything in the core kit + 13 advanced production features and a 1:1 setup call. Each one is flag-gated and removable in one line.

$199$149one-time · lifetime updates
Get Swift Kit Pro

The Swift Kit vs Swift Kit Pro

The Swift Kit$99

The complete core boilerplate to launch fast.

  • Auth + Sign in with Apple (Supabase)
  • Paywalls (RevenueCat + StoreKit 2)
  • AI: chat, images, vision
  • 3 onboarding templates
  • Analytics + push notifications
  • 5-layer design system + setup CLI
Swift Kit Pro$199$149

Everything in core, plus 13 advanced features & a 1:1 setup call.

  • Everything in The Swift Kit
  • AI PRO: streaming chat + history
  • Widgets + Live Activities
  • Gamification: XP, levels, streaks
  • Camera + scanner + OCR, SwiftData
  • 1:1 onboarding + priority support

What is inside Pro — 13 features

AI PRO — Streaming Chat

Token-by-token streaming with persisted history. Works with OpenAI or Gemini, with an offline mock fallback.

aiPro
Widgets + Live Activities

Home & lock-screen widgets, a Live Activity, and Dynamic Island — as a ready embedded extension target.

widgets
Gamification

XP, levels, badges, and streaks with automatic level-up and badge celebration overlays.

gamification
Questionnaire Onboarding

A config-driven quiz/survey onboarding flow with progress and persisted answers.

questionnaireOnboarding
Camera + Scanner + OCR

VisionKit document scanner, Vision text recognition, and a PhotosUI image picker.

camera
Reminders

Daily reminders, streak nudges, and test notifications via UNUserNotificationCenter. No server needed.

reminders
SwiftData Store

An offline-first CRUD store on SwiftData. Availability-gated to iOS 17.

swiftDataStore
10 Paywall Templates

Ten premium, conversion-focused paywall designs plus a preview gallery — one model drives all copy.

paywallTemplates
Swift Charts

A ready-to-customize Swift Charts demo screen.

charts
In-App Feedback

A category + message feedback form with an offline-friendly service.

inAppFeedback
Biometric App Lock

Opt-in Face ID / Touch ID lock gate that fails open when no biometrics are enrolled.

biometricLock
Runtime Localization

An in-app language picker that switches strings live, without a restart. Ships en, es, hi.

localization

Modular by design

Pro is a boilerplate, not a framework. Every feature is a boolean in Config/FeatureFlags.swift, lives in its own Modules/<Feature>/ folder, and has a prompt in the setup CLI. Removing one never touches the rest.

Config/FeatureFlags.swiftswift
// 20 flags total — 7 base + 13 Pro
public var aiPro: Bool
public var widgets: Bool
public var gamification: Bool
// …

// To remove a feature completely:
//   1. set its flag to false in AppConfig.default
//   2. delete its Modules/<Feature>/ folder
//   3. run `xcodegen generate`  →  it is gone, app still builds
🎁 Done-with-you setup. Pro includes a 1:1 onboarding & setup session and priority 1:1 support — we get your app configured and running with you, then keep you unblocked.
The Swift Kit Pro
$199$149one-time · lifetime updates
Get Swift Kit Pro

AI PRO — Streaming Chat

Users expect ChatGPT-style responses that stream in token-by-token. AI PRO does exactly that, persists the conversation, and is provider-agnostic — point it at OpenAI or Gemini with one env var.

Modules/AIPro — usageswift
let client = AIProStreamClient()

// Tokens arrive live over Server-Sent Events
for try await delta in client.stream(messages: history) {
    message.text += delta
}
// No backend running yet? It falls back to an offline mock stream,
// so the chat always demos.

Switch providers in one line

Backend/Python/.envbash
LLM_PROVIDER=gemini        # or: openai
GEMINI_API_KEY=your_key    # or: OPENAI_API_KEY=your_key
# The /v1/chat/stream SSE endpoint serves both providers.
Enable it with the aiPro flag. Set Secrets.aiBackendBaseURLString to your deployed Flask server to go live.
The Swift Kit Pro
$199$149one-time · lifetime updates
Get Swift Kit Pro

Widgets & Live Activities

Home and lock-screen presence is the cheapest retention you can buy. Pro ships a WidgetKit widget, a Live Activity, and Dynamic Island support as a ready, embedded app-extension target — the hardest part of widgets to wire up by hand.

Widgets/Shared — usageswift
// Start a Live Activity (Dynamic Island + lock screen)
LiveActivityController.shared.start(
    title: "Order on the way",
    progress: 0.4
)

// End all of them
LiveActivityController.shared.endAll()
Shared types in Widgets/Shared compile into both the app and the extension. To show real data on the home screen, add an App Group to both targets and share a container — documented inline.
The Swift Kit Pro
$199$149one-time · lifetime updates
Get Swift Kit Pro

Gamification

XP, levels, badges, and streaks are what turn a one-time open into a daily habit. The engine is modeled on the services in real shipped apps, and a single call does the work.

Modules/Gamification — usageswift
// One call awards XP, updates the streak, and unlocks badges
GamificationEngine.shared.recordAction(.completedTask)

// Drop celebration overlays in once — they fire automatically
SomeView()
    .gamificationCelebrations()
Everything persists to UserDefaults out of the box. Enable it with the gamification flag; pair it with for streak-protection nudges.
The Swift Kit Pro
$199$149one-time · lifetime updates
Get Swift Kit Pro

More Pro Modules

The rest of the Pro toolkit — each self-contained, flag-gated, and demoable from the in-app Test Drive hub.

Questionnaire Onboarding

Config-driven quiz onboarding with progress and persisted answers — great for personalization and segmentation.

questionnaireOnboarding
Camera + Scanner + OCR

VisionKit document scanner + Vision text recognition + PhotosUI picker. Scan a doc, extract its text.

camera
Reminders

Daily, streak, and test local notifications — no push server required.

reminders
SwiftData Store

Offline-first CRUD on SwiftData (iOS 17). The base kit stays on iOS 16.

swiftDataStore
10 Paywall Templates

Premium, conversion-focused paywall designs + a preview gallery. One model drives all copy; DS tokens drive visuals.

paywallTemplates
Biometric App Lock

Opt-in Face ID / Touch ID gate that fails open if no biometrics are enrolled.

biometricLock
Runtime Localization

Live in-app language switching without a restart. Ships English, Spanish, Hindi.

localization
Swift Charts + Feedback

A customizable Swift Charts screen and an offline-friendly in-app feedback form.

charts · inAppFeedback
Every module deletes cleanly. Flip the flag, delete the folder, run xcodegen generate. No dangling references, no broken build — that is the whole point of a boilerplate.

Read this far? You are ready to build faster.

These features take weeks to build and debug from scratch — widgets and Live Activities alone are a multi-day rabbit hole. Pro hands them to you wired, demoable, and removable, plus a 1:1 call to set it all up.

The Swift Kit Pro

Everything in the core kit + 13 advanced production features and a 1:1 setup call. Each one is flag-gated and removable in one line.

$199$149one-time · lifetime updates
Get Swift Kit Pro

That's it — clone, configure, and ship. TheSwiftKit adapts based on the SDKs and keys you provide, so you can start simple and layer on services when you're ready.