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.
Prerequisites
Xcode 15+
Latest stable recommended
iOS 16+
Deployment target
Swift 5.9+
Ships with Xcode 15
Setup Steps
Clone the repository
Clone the repo and open TheSwiftKit.xcodeproj in Xcode.
git clone https://github.com/your-username/TheSwiftKit.git
cd TheSwiftKit
open TheSwiftKit.xcodeprojRun the setup script
The setup script creates your Secrets.swift file from the sample and installs any dependencies.
./setup.shAdd your API keys
Open Config/Secrets.swift and paste your keys. You only need Supabase credentials to start — everything else is optional.
enum Secrets {
static let supabaseURL = "https://your-project.supabase.co"
static let supabaseAnonKey = "eyJ..."
static let revenueCatAPIKey = "appl_..." // optional
static let telemetryDeckID = "..." // optional
}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.
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.stringsConfig/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.
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.
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.
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"
}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.
// 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:
Enable the capability
Sign in with Apple.Configure Supabase
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.
// 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 AppOnboarding 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
// Change this one line to switch onboarding:
static let onboardingStyle = .highlights // .carousel, .highlights, .minimalCustomizing Content
Edit the onboarding pages in Modules/Onboarding/OnboardingModels.swift. The __APP_NAME__ token is automatically replaced with your app name at runtime.
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
Create products in App Store Connect
Configure RevenueCat
Add your API key
Paste your RevenueCat public API key in Secrets.swift:
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.
// 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.
# 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 }// 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.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.
static let telemetryDeckAppID = "YOUR_APP_ID"
// That's it. The AnalyticsService initializes automatically
// when this key is present.// 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.
// 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
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) }
}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.
// 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
Archive your build
Product > Archive. Make sure you are building for Any iOS Device (not a simulator).Upload to App Store Connect
Distribute App and follow the prompts to upload to App Store Connect.Add testers
App Store Submission Checklist
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.swiftis 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.
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.