Skip to main content
SwiftUI apps integrate Candid in three steps: configure the SDK with your API key and user ID, attach the .candidOverlay() modifier to your root view so the research UI has a place to render, then call Candid.register(trigger:) whenever you want a study to begin. All three steps are independent of your navigation stack, the overlay sits above everything else in the window.

Configure the SDK

Call Candid.configure(_:) once before your app presents any UI. The recommended place is App.init, but a .task modifier on the root view also works if you prefer to defer until the first scene appears. Candid.Configuration accepts the following parameters: The participant identifier is set separately with Candid.setUserId(_:), at any time (e.g. after login).
Call Candid.configure(_:) before Candid.register(trigger:). If you call register(trigger:) first, the SDK has no API key and cannot load or upload a research session.

Attach the overlay

Add .candidOverlay() to your root view: the view that fills the entire window. The modifier inserts an invisible layer that Candid uses to present the research bubble, permission prompts, and recording controls above your app’s content.
Apply .candidOverlay() exactly once at the root of your view hierarchy. Attaching it to a child view or inside a NavigationStack clips the overlay to that view’s bounds and causes layout issues.

Register a trigger

Call Candid.register(trigger:) to load the currently running study associated to a trigger from your Candid dashboard and present it to the user. Register triggers when a specific screen appears, or after any meaningful event in your app.
1

From a button

2

On screen appear

3

After an event

Complete minimal app

The following is a self-contained SwiftUI app showing every required piece together: