Skip to main content

iOS SDK Functions

Complete reference for the Told iOS SDK API.

INIT

Initialize the SDK. Must be called before any other function, typically in your AppDelegate.

let configuration: ToldConfiguration = .init(
sourceId: "YOUR_SOURCE_ID",
applicationId: "YOUR_BUNDLE_ID",
environment: .production,
appVersion: "1.0.0",
preview: false
)
Told.init(configuration)

IDENTIFY

Update the current user's information:

Told.identify(properties: ["id": "user_123", "name": "Jane", "email": "[email protected]"])

SET LANGUAGE

Override automatic language detection:

Told.identify(properties: ["language": "en"])

TRACK EVENT

Send a custom event for triggering surveys:

Told.trackEvent(eventName: "purchase_completed", properties: ["amount": 49.99])

ACTIVATE AUTOMATIC SCREEN TRACKING

Enable automatic tracking of screen changes using method swizzling on UIViewController.viewDidAppear(_:):

Told.activateAutomaticScreenTracking()
info

SwiftUI views managed by UIHostingController are tracked, but pure SwiftUI navigation without UIKit backing may not be detected. Use trackChangePage for those cases.


DEACTIVATE AUTOMATIC SCREEN TRACKING

Disable automatic screen tracking:

Told.deactivateAutomaticScreenTracking()

TRACK CHANGE PAGE

Manually track a page/screen change. Use this for SwiftUI or custom navigation:

Told.trackChangePage("SettingsScreen")

START

Manually start a specific survey by ID:

Told.start(surveyId: "SURVEY_ID", delay: 0)

RESET

Reset the user to anonymous state. Call this when the user logs out:

Told.reset()

DEBUG WIDGET

Log diagnostic information about your source and surveys (info log level):

Told.debugWidget()