Skip to content

iOS installation

  • iOS 15 or later
  • Xcode 15 or later (Swift 5.9)
  • Swift Package Manager or CocoaPods
  • The team’s SDK key (rsk_…) from the form’s Share → Mobile app tab

The module is ResponslySDK. It has no third-party dependencies. App extensions are not supported: a survey needs an app window.

The steps use the package URL you received with your access. It is written as <package URL> below.

In Xcode:

  1. Choose File → Add Package Dependencies…
  2. Enter the package URL.
  3. Set the dependency rule to Up to Next Major Version from 1.34.0.
  4. Add the ResponslySDK product to your app target.

Or in Package.swift:

Package.swift
dependencies: [
.package(url: "<package URL>", from: "1.34.0"),
],
targets: [
.target(
name: "MyApp",
dependencies: [
.product(name: "ResponslySDK", package: "responsly-ios-sdk"),
]
),
]

Call initialize once, as early as possible. Calls made before it (identify, track, screen and the rest) are remembered and applied when the SDK starts.

import SwiftUI
import ResponslySDK
@main
struct MyApp: App {
init() {
#if DEBUG
let options = ResponslyOptions(logLevel: .debug)
#else
let options = ResponslyOptions(logLevel: .error)
#endif
Responsly.shared.initialize(sdkKey: "rsk_…", options: options)
}
var body: some Scene {
WindowGroup { ContentView() }
}
}

initialize is idempotent for the same key. Calling it with a different key resets the SDK’s local state first.

ResponslyOptions has two fields. Both have defaults, and options itself can be left out: Responsly.shared.initialize(sdkKey: "rsk_…").

FieldValuesNotes
logLevel.none, .error, .info, .debugDefaults to .error. Use .debug while integrating. See Testing & debugging.
apiHostURLDefaults to https://api.responsly.com. Leave it unset unless Responsly support gives you another host.
  • Pass a view controller. The SDK presents surveys above the app’s current top view controller by itself.
  • Add permissions. The SDK asks for none and uses no advertising identifier. The one exception is described below.
  • Write a privacy manifest for the SDK. It ships its own PrivacyInfo.xcprivacy. See Privacy & data.

File upload questions work without setup. If a survey lets respondents take a photo or record a video, the app’s Info.plist needs the usual camera keys, as for any camera use on iOS:

Info.plist
<key>NSCameraUsageDescription</key>
<string>Lets you attach a photo to your answer.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Lets you record a video for your answer.</string>

NSMicrophoneUsageDescription is needed only for video.

print(Responsly.sdkVersion) // "1.34.0"

Run the app with the .debug log level and look for lines prefixed [Responsly] in the Xcode console.