Swift UI App
Last updated
Last updated
Below are the various processes involved in setting up SpotChecks in IOS. Kindly refer example applications
Open XCode and click on "File" menu
Click on "Add Package Dependency"
Enter the package URL -
Select the version of SDK and Add to App Targets.
Then, click on Add Package to add the SurveySparrowSdk package to your IOS project.
The SurveySparrowSdk package can also be added by navigating to your target's General panel -> In the “Frameworks, Libraries, and Embedded Content” section, click on the + button -> select "Add Other "-> choose "Add Package Dependency" -> Enter the above package URL -> Click on Add Package.
Import the SurveySparrowSdk and initialize a variable named spotCheck.
Anonymous users
If you wish not to keep track of users' data, you can follow the below syntax for initialization.
Known Users
If you wish to keep track of users' data and perform conditional Survey triggers, you can follow the below syntax for initialization.
Add the spotCheck in the Zstack of the topmost parent
It provides the ability to keep track of screens the users are visiting and to enable the survey trigger on that screen.
If a survey needs to be triggered on the payment page, the name of the ScreenName should be specified in the TrackScreen function.
It provides the ability to keep track of events which when triggered, will enable the survey to be popped.
If a survey needs to be triggered when the user completes a payment, then the TrackEvent function should be called with the respective ScreenName and optional custom properties.
Callbacks are used to listen to events that are part of the SpotChecks. Below are the events:
Survey Response - triggers when the user submits a response.
Survey Loaded - triggers when the SpotChecks is loaded on the user's page.
Survey Close - triggers when the SpotChecks is closed by the user.