Setup
To run the project, open Formbricks.xcworkspace in Xcode. The workspace contains two projects:
- FormbricksSDK: The SDK package.
- Demo: A demo application to exercise the SDK.
Before launching the Demo app, update the mandatory variables in AppDelegate:
let config = FormbricksConfig.Builder(appUrl: "[APP_URL]", environmentId: "[ENVIRONMENT_ID]")
.setLogLevel(.debug)
.build()
Once these values are properly set, the demo app can be launched.
The demo app consists of a single view, ContentView. It is a SwiftUI view with a single button.
The button's action should be updated according to the survey actions:
Formbricks.track("click_demo_button")
Replace "click_demo_button" with the desired action.
Swift Documentation
You can generate developer documentation for the SDK by pressing Shift + Command + Option + D on macOS or by selecting Product → Build Documentation in Xcode.
Unit Tests
The SDK includes a unit test to verify the Manager's functionality. To run it:
- Select the
Test Navigatortab in Xcode. - Run the
testFormbricks()method.
The coverage report can be found in the Report Navigator tab.