UIViewController so the SDK knows where to anchor its research bubble and modal screens. Use Candid.attachUIKitOverlay(to:) right after you set your window’s root view controller, and call Candid.register(trigger:) whenever you want a study to start. (In SDK versions before 0.2.0 this method was named attachOverlay(to:).)
Configure the SDK
CallCandid.configure(_:) once at launch, before your app presents any UI. AppDelegate.application(_:didFinishLaunchingWithOptions:) and SceneDelegate.scene(_:willConnectTo:options:) are both appropriate places.
SceneDelegate instead:
Attach the overlay
After you assign a root view controller to yourUIWindow, call Candid.attachUIKitOverlay(to:) with that same root controller. The SDK adds a transparent overlay view above your app’s interface to host the research bubble and modal screens. The overlay only intercepts touches that land on visible Candid UI; everything else passes through to your app.
Pass your root view controller, the one assigned to
window.rootViewController, not a child, tab, or presented controller. Attaching to a child controller clips the overlay to that controller’s view bounds and breaks the layout of the research bubble.Register a trigger
CallCandid.register(trigger:) wherever it makes sense in your app flow. Candid fetches the currently running study from your dashboard and presents it over your content.
1
From a UIButton action
2
In viewDidAppear
3
After a condition
Detach the overlay
CallCandid.detachUIKitOverlay() when you no longer need the research UI, for example, when the user logs out or when a particular scene is torn down.
Candid.attachUIKitOverlay(to:) again with a new root controller.