SDK Reference
WhiskrKit.shared
Section titled “WhiskrKit.shared”The singleton entry point for all SDK interactions. All methods must be called on the main actor.
initialize(apiKey:withMockedSurveys:)
Section titled “initialize(apiKey:withMockedSurveys:)”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)| Parameter | Type | Description |
|---|---|---|
apiKey | String | Your WhiskrKit API key from the dashboard |
withMockedSurveys | Bool | Use 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.
setTheme(_:)
Section titled “setTheme(_:)”Applies a visual theme to all survey UI. Call after initialize.
WhiskrKit.shared.setTheme(.systemStyle)| Parameter | Type | Description |
|---|---|---|
theme | WhiskrKitTheme | The theme to apply |
present(surveyId:)
Section titled “present(surveyId:)”Imperatively presents a survey, bypassing eligibility checks.
WhiskrKit.shared.present(surveyId: "nps-survey")| Parameter | Type | Description |
|---|---|---|
surveyId | String | The 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.
View modifiers
Section titled “View modifiers”.whiskrKitSurvey(identifier:)
Section titled “.whiskrKitSurvey(identifier:)”Automatically evaluates eligibility and presents a survey when the modified view appears.
HomeView() .whiskrKitSurvey(identifier: "nps-survey")| Parameter | Type | Description |
|---|---|---|
identifier | String | The survey identifier from the dashboard |
.whiskrKit()
Section titled “.whiskrKit()”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.
Platform requirements
Section titled “Platform requirements”| Platform | Minimum version |
|---|---|
| iOS | 17.0 |
| iPadOS | 17.0 |