Features

Configurations

Configurations Documentation

The ShipThatApp SwiftUI boilerplate comes with several pre-configured services and functionality that assist in setting up analytics, in-app purchases, and authentication. These configurations are critical for the app to work correctly and to ensure that developers have full access to modify and adapt these services based on their project needs.

TelemetryDeck (Analytics)

TelemetryDeck is an analytics service used to track user behavior and app performance. It is important to configure this service with the correct APP ID to gather analytics.

TD Configuration Details

  1. Find the App ID from your TelemetryDeck account.

  2. Insert the App ID into the Info.plist file under the key TD_APP_ID.

  3. Initialize the Telemetry manager with the configuration in ShipThatAppApp.swift:

    private func configureTelemetry() {
        guard let telemetryDeckAppID = Bundle.main.infoDictionary?["TD_APP_ID"] as? String else { return }
        let configuration = TelemetryManagerConfiguration(appID: telemetryDeckAppID)
        TelemetryManager.initialize(with: configuration)
    }
    
  4. Call the configureTelemetry function within the init() of ShipThatAppApp.

RevenueCat (In-App Purchases)

RevenueCat is a service that helps you manage in-app purchases and subscriptions. Setting up RevenueCat correctly is vital for the monetization aspect of the app.

RC Configuration Details:

  1. Obtain the API Key from your RevenueCat dashboard.

  2. Add the API Key to the Info.plist file under the key RC_API_KEY.

  3. Set up RevenueCat in ShipThatAppApp.swift:

    private func configureRevenueCat() {
        guard let revenueCatApiString = Bundle.main.infoDictionary?["RC_API_KEY"] as? String else { return }
        Purchases.logLevel = .debug
        Purchases.configure(withAPIKey: revenueCatApiString)
    }
    
  4. Call the configureRevenueCat function within the init() of ShipThatAppApp.

Authentication (Supabase)

Authentication using Supabase allows for various methods such as email/password, magic link, and social providers like Sign in with Apple.

SB Configuration Details:

  1. Set up your Supabase instance and obtain the URL and Annon Key.

  2. Configure the auth client in AuthManager.swift:

    let client = SupabaseClient(supabaseURL: URL(string: "https://your-instance.supabase.co")!, supabaseKey: "your-supabase-annon-key")
    
  3. Replace the placeholders with your actual Supabase URL and Annon Key.

  4. Utilize AuthManager throughout the app for handling authentication flows.

iOS requires a custom URL scheme to handle incoming magic links for passwordless authentication.

  1. Register a URL scheme for your app in the Info.plist:

    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>shipthatapp</string>
            </array>
        </dict>
    </array>
    
  2. Replace shipthatapp with your custom scheme.

  3. Implement the URL handling in ShipThatAppApp.swift to redirect to the auth flow when a magic link is accessed.

Splash Screen Delay

To configure the duration of the splash screen display:

SC Configuration Details

  1. Set up a custom delay duration in ShipThatAppApp.swift:

    private func dismissSplashScreenAfterDelay() async {
        try? await Task.sleep(for: .seconds(1)) // Set your desired time here
        splashScreenState.dismiss()
    }
    
  2. Adjust the seconds to the desired splash screen duration.

These configurations are essential to make ShipThatApp work out-of-the-box. Ensure that all the services are set up correctly and the placeholders are replaced with your actual project details. By following these configuration steps, you can customize ShipThatApp to fit the needs of your specific application.

Previous
Project Structure