Candid is the top-level @MainActor enum that acts as the single namespace for all SDK interactions. You never instantiate it directly; instead you call its static methods and set its static properties from your app’s main actor context. The sections below cover every public API member in declaration order.
configure(_:)
App.init() or application(_:didFinishLaunchingWithOptions:)), before invoking any other SDK method. Calling it more than once replaces the active configuration.
Candid.Configuration
required
The configuration value that controls your API key, reward, recording duration, step timings, and visual appearance. See Candid.Configuration for the full field reference.
setUserId(_:)
nil. Call it at any time, before or after configure(_:), for example once the user logs in. When no user id is set, requests are sent anonymously and once-per-user study presentation is tracked locally per install.
String?
required
A stable identifier for the current participant in your own system, for example a database row ID or hashed email. Pass
nil to clear it (e.g. on sign-out).register(trigger:)
String
required
Your trigger name. You choose this value and it should match the trigger from a study in your dashboard.
log(_:)
String
required
The event name. This must match the
event (or one of the matchingEvents) on the Candid.Task you want to complete. Matching is case-sensitive.Examples: "add_to_cart", "checkout_tapped", "photo_uploaded"attachUIKitOverlay(to:) and detachUIKitOverlay()
.candidOverlay() modifier, for example in a UIKit-only app or when your root view controller is set up imperatively.
attachUIKitOverlay(to:) installs the overlay as a child of the provided view controller; detachUIKitOverlay() removes it. The overlay only intercepts touches that land on visible Candid UI; everything else passes through to your app. You only need to call attachUIKitOverlay(to:) once; the SDK retains the reference until you call detachUIKitOverlay() or reset().
UIViewController
required
The root
UIViewController to which the Candid overlay will be attached. Pass the window’s root view controller for full-screen coverage.candidOverlay()
View extension method that attaches the Candid recording overlay to your view hierarchy. Apply it at the root of your app’s scene so the overlay can appear on top of any screen.