Skip to content

SDK Reference

The singleton entry point for all SDK interactions. All methods must be called on the main actor.


Initialises the SDK. Must be called before any other WhiskrKit method, typically in your App init.

WhiskrKit.shared.initialize(
apiKey: "wk_live_your_api_key",
withMockedSurveys: false
)
ParameterTypeDescription
apiKeyStringYour WhiskrKit API key from the dashboard
withMockedSurveysBoolUse mock data for local testing without hitting the API

When withMockedSurveys is true, the SDK uses a local MockConfigurationService and bypasses all network calls. Useful during development and UI testing.


Applies a visual theme to all survey UI. Call after initialize.

WhiskrKit.shared.setTheme(.systemStyle)
ParameterTypeDescription
themeWhiskrKitThemeThe theme to apply

Imperatively presents a survey, bypassing eligibility checks.

WhiskrKit.shared.present(surveyId: "nps-survey")
ParameterTypeDescription
surveyIdStringThe identifier of the survey to present

Requires at least one view in the hierarchy with .whiskrKit() attached. If none is present, this is a no-op.


Automatically evaluates eligibility and presents a survey when the modified view appears.

HomeView()
.whiskrKitSurvey(identifier: "nps-survey")
ParameterTypeDescription
identifierStringThe survey identifier from the dashboard

Registers a view as the attachment point for imperatively triggered surveys. Does not perform eligibility checks on its own.

ContentView()
.whiskrKit()

Apply once, high in your view hierarchy.


PlatformMinimum version
iOS17.0
iPadOS17.0