New in CUX: Mobile Analytics. Analyze real user behavior inside your app. Learn More

Install the iOS SDK

Install the iOS SDK

Browse topics

On this page

Install the CUX iOS SDK to collect navigation, interactions and available screenshots from your app. Test one familiar journey before you add user identification or custom events.

Version covered: 1.1.11. Requires iOS 15 or later.

Requirements

  • An iOS app with UIKit or SwiftUI.
  • Xcode and a toolchain compatible with the SDK distribution you install.
  • A CUX mobile project and its token from Settings > Project.

Choose one installation method. Do not add the SDK through both Swift Package Manager and CocoaPods in the same target.

Install with Swift Package Manager

  1. In Xcode, open File > Add Package Dependencies.
  2. Enter https://bitbucket.org/cuxio/public-ios-sdk.
  3. Choose Exact Version 1.1.11.
  4. Add the AnalyticsSDK product to your app target.

Resolve the package and build your target. If Xcode cannot load the binary module, check toolchain compatibility before changing the version or adding another distribution.

Install with CocoaPods

Add the SDK to your app target in the Podfile:

pod 'CuxAnalyticsSDK', '1.1.11'

Run pod install and open the generated workspace.

Initialize the SDK

Call setup() once during app startup. Replace the placeholder with your mobile project token. The following examples wait for your app's consent handling.

UIKit

Add this to your existing AppDelegate startup method:

import UIKit
import AnalyticsSDK

func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
    CuxAnalytics.shared.setup(
        token: "YOUR_MOBILE_PROJECT_TOKEN",
        loglevel: .production,
        needConfirmToStart: true
    )
    return true
}

Keep any other initialization your app already performs in this method.

SwiftUI

Initialize once in your existing App type:

import SwiftUI
import AnalyticsSDK

@main
struct MyApp: App {
    init() {
        CuxAnalytics.shared.setup(
            token: "YOUR_MOBILE_PROJECT_TOKEN",
            loglevel: .production,
            needConfirmToStart: true
        )
    }

    var body: some Scene {
        WindowGroup { ContentView() }
    }
}

ContentView is your existing root view. Use the setup path that matches your app rather than adding a second initializer.

Choose your next step

TaskGuide
Check navigation and name SwiftUI destinationsTrack and name iOS screens
Identify accounts and record completed outcomesIdentify users and track iOS custom events
Handle consent and hide sensitive contentControl iOS collection and mask content
Diagnose installation or recording problemsTroubleshoot your iOS integration

Verify your integration

  1. Run a known journey after collection is allowed.
  2. Compare recorded navigation and interactions with your actions.
  3. Check SwiftUI names where you added the modifier.
  4. Inspect available screenshots and masks after scrolling, rotation and loading content.
  5. Check identification/events if you added them.
  6. Test consent withdrawal and screenshot pause/resume separately.

Screenshot availability depends on configuration and capture conditions. The Android WebView bridge and preview-stitching instructions do not establish support in iOS 1.1.11.

Continue with Configure mobile data collection or Mobile masking and privacy.

Control data collection

Resume or stop collection from your consent handling. Follow the detailed guide.

Name SwiftUI screens

Give your actual SwiftUI destinations stable names. Follow the detailed guide.

Hide sensitive content

Mask sensitive UIKit and SwiftUI content before capture. Follow the detailed guide.

Identify users

Use a stable internal identifier after login. Follow the detailed guide.

Track custom events

Send an event when your app confirms an outcome. Follow the detailed guide.