Survicate iOS SDK
The iOS SDK is distributed in a binary version and developed using Swift 5.7. For apps downloaded from the App Store, the Survicate iOS SDK adds ~ 7.2MB to your uncompressed app size on device.
- Using Survicate Mobile SDK requires an account at survicate.com. You can create your account here for free, or become invited to your company account by one of your colleagues.
- Xcode 14 is required to to build iOS SDK.
- Respondent's device running iOS 12 or above.
There are three ways to install the Survicate Mobile SDK in the iOS applications:
Installing as Swift Package
The recommended installation method.
- Once your iOS application project is ready, open it in the Xcode and select your project’s Package Dependencies tab
- Copy the Survicate SDK Swift package repository URL
https://github.com/Survicate/survicate-ios-sdkinto the search field
- Under the Dependency Rule, select the version of your preference.
- After the package download completes, select Add Package.
Survicate SDK should now be listed under Swift Package Dependencies in the Xcode Project Navigator.
Installing using CocoaPods
Define pod in your
Podfile and run
- Download and extract the Survicate for iOS
- Drag Survicate.framework into your project. Make sure "Copy items if needed" is selected and click Finish.
- In the target settings for your app, set the Survicate.framework to “Embed & Sign”. You'll find it in the “Frameworks, Libraries, and Embedded Content” section of the “General” tab.
The following configuration will require a Workspace Key. You can get your workspace key in the Access Keys section of the Survicate panel.
- Add workspace key to your
SurvicateDictionary. This is how your
Info.plistfile should look like:
- Initialize the SDK using the
initializemethod. Choose an initialization method described below based on whether your project utilizes 'AppDelegate' class.
Make sure that
import Survicate line exists in all classes where you call SDK methods.
Survicate iOS SDK can be used in SwiftUI projects. If your SwiftUI project doesn't use the
AppDelegate class, the initialization of the Survicate Mobile SDK can be done in the constructor of the main application class:
As an alternative to the main way of specifying the Workspace Key, you can also use the
setWorkspaceKey()method overrides the Workspace Key defined in the configuration.
setWorkspaceKey()method must be used before
init()method is called.
Survicate allows you to launch precisely targeted surveys inside your app. In Survicate Panel, you'll be able to define conditions that your users have to meet for the surveys to appear. Users matching conditions defined in the Survicate panel will see the survey automatically. Here's a list of conditions you can use to target your surveys:
- Name of the screen that a user currently sees
- Any application event
- User attributes and identities
- Device language
- Operating system
Make sure to list all the screens and events described in your application. Once you got this covered, you or any person responsible for creating and managing surveys will be able to trigger surveys from the Survicate panel with no need for you to update the application.
Warning The SDK utilizes UserDefaults to store information used by the targeting engine described in this section. Clearing UserDefaults will cause the targeting system to malfunction; f.e. by showing the same survey twice to a single user.
Targeting a survey by the screen name
A survey can appear when a user is viewing a specific screen. For example, a survey can be triggered to show up on the application's home screen after a user spends more than ten seconds there. To achieve that, you need to send information to Survicate about the user entering and leaving a screen.
Screen name is case sensitive. If there's any discrepancy between what's declared in the ‘Screens’ tab of the Target section in the Survicate panel and the application code, the survey will not appear.
Events-based survey targeting
You can log custom user events throughout your application. They can later be used in the Survicate panel to trigger your surveys. Your survey will instantly after an event occurs in your app.
Event name is case sensitive. If there is any discrepancy between what's declared in the ‘Triggers’ tab of the Target section in the Survicate panel and the application code, the survey will not appear.
User identification & attributes
You can pass user attributes to Survicate as an additional layer of information about your users. Attributes can be used to:
- Identify respondents (by default survey responses are anonymous)
- Trigger surveys
- Filter survey results
Bear in mind that user attributes are cached, you only have to provide them once, e.g. when user logs in, not after each
init(). You can also change their values at any time (which may potentially trigger showing the survey).
Reseting user data for testing purposes
If you need to test surveys on your device,
reset() method might be helpful. This method will reset all user data stored on your device (survey views, attributes, and information about answered surveys for the targeting engine).
SDK allows you to utilize event listeners. You may find them useful to trigger actions in your application based on actions performed by respondents. Here's a list of events you can subscribe to:
- survey_displayed - occurs when survey is loaded and appears in the User Interface
- question_answered - occurs after a question is answered ( Survicate stores incomplete survey submissions )
- survey_closed - occurs when a user closes the survey using the close button
- survey_completed - occurs when a user finishes the survey.
SurvicateAnswer object properties
|id||integer||Answer ID. Applicable only for type = ['single', 'smiley_scale', 'dropdown_list', 'rating'].|
|ids||integer||Array of answer IDs. Applicable only for type = ['multiple'].|
|value||string||Context value of the answer. Applicable only for type = ['text', 'nps', 'date'].|
Note: We currently support passing the
value properties only for the cases enlisted in the table above. You can expect to stumble upon answer objects that consist only of the
- An issue when it was not possible to filter survey responses by language in the panel.
An issue where after synchronization failure the SDK was not respecting refresh interval.
An issue where submit button on iPad was not displayed correctly.
- Now while adding introduction or question texts you can recall information from attributes passed to Survicate or from answers to other questions in the survey.
- Assigning answers to the wrong survey within the same workspace.
- Surveys can be translated into an app language if a corresponding translation is added in the panel.
- Bug that caused a crash when calling SDK on multiple threads.
- Visible hyphen even in the absence of a label in NPS and rating scale.
- Rating question type added.
Question and introduction texts can be made bold, italics, or hyperlinked.
- Special characters encoding issue.
- Disabled dismiss on overlay tap.
- 21 new design themes.
2 new survey settings - “Progress bar” and “Remove Survicate branding”.
New customization options: add a company's logo or a survey sender's avatar and a greeting message from them.
- Accuracy of survey sampling.
- Code causing priority inversion warning to be displayed.
- Language detection issues.
- Remove character limit from text fields.
- An issue of not showing the survey on dismissing the view controller.
- Problem with truncating endings in long answer texts.
An issues causing a survey to be displayed repeatedly, when using a delayed display feature.
A possible race condition when multiple SDK methods are called at the same time.
An issue causing NPS button labels to be displayed in incorrect colors.
The minimum iOS version requirement for the respondent's device is now iOS 12.
- Layout fixes for large displays.
- Answers for smiley scale questions could be not stored.
- Tracking the SDK version for internal purposes.
Detailed answer value for the Smile scale question is provided in the Question answered event listener.
- Survey layout issues.
- Memory leaks.
Survicate Mobile SDK can now be integrated using Swift Package Manager.
Please refer to the installation documentation to see, how to integrate Survicate Mobile SDK using Swift Package Manager.
Improved UI rendering speed, we fixed minor layout glitches and some memory leaks.
- UI rendering speed and layout glitches.
- Memory leaks and UI rendering speed.
When setting the survey to appear to less than 1% of targeted users, the survey was not displayed. In general, the audience sampling feature in the targeting engine had issues with interpreting numbers with decimal points.
In some cases survey settings (TTL) mechanism was not refreshed correctly.
- Survey settings Time to Live(TTL) reduced to 10 minutes.
setWorkspaceKey()method is now working properly, as described in the documentation.
The minimum Xcode version required to run Survicate Mobile SDK is now: 12.5.1
Surveys can now be set to appear on a recurring basis. This means respondents can answer the same mobile survey again, and again - on a daily, weekly, monthly, or quarterly basis.
- Scale labels can now be displayed below the smiley scale question
Survey settings Time to Live(TTL) mechanism on respondent's device. The mechanism ensures that the survey settings are up to date on the respondent's side. If the current version of survey settings is older than 60 minutes, the survey configuration is checked for updates.
setWorkspaceKey()allows to specify Survicate workspace key from code.
Locales used by SDK were improved to resolve issue related to warning WARNING ITMS-90176 appearing during upload the app using SDK to the AppStore
We restored the minimum iOS version required for the SDK to work to 10.0.
Survicate iOS SDK is now distributed as an XCFramework binary, making the SDK compatible with Swift 5.x. As a result, the main class of Survicate Mobile SDK had to be renamed.
The version 1.5.3 of the Survicate iOS SDK introduces support for binary framework, which causes a minor backward compatibility break. Until the version 1.5.3 the main SDK class was called
Survicate, in the version 1.5.3 that class was renamed to
SurvicateSdk. The change was introduced to make it possible to distribute Survicate Mobile SDK as the XCFramework binary.
- Support for using the Survicate Mobile SDK with Swift 5.x
- Provides support for using the Survicate Mobile SDK with Swift 5.4.1
Multiple choice question are shown as checkboxes instead of radio buttons
- SDK uses currently respondent API v3 endpoints
cornerRadiusextension was renamed in order to avoid conflict in apps that would use SDK
- Supported Swift version 5.4.
An issue that caused targeting by attributes to malfunction in some cases.
- Supported Swift version 5.3.1.
- Supported Swift version 5.3.
It’s now possible to suppress a survey if other was answered during the current visit to your app.
Unnecessary spacing on the left side of the question has been removed.
- Proper handling of 4xx error codes.
A bug causing surveys not to appear when targeted only at logged in users.
A minor issue causing the survey not to appear when targeted at multiple values of the same attribute.
- Supported Swift version 5.2.
- SDK listeners - answer object minor fixes.
- SDK now supports listeners.
- Survey ends after Thank you message and CTA.
- SDK now supports survey completion rate.
- Surveys layout leaned on right column.
- Supported Swift version 5.1.
- SDK now supports new installation flow.
- Skip-logic wasn't functioning properly in some cases.
reset()method didn't clear user attributes.
- Supported Swift version 5.0.
- Surveys were sometimes shown on a wrong 'ViewController'.
UserTraitdefault constructor was missing.