Getting Started with Swift
1. Instrumentation
Start the SDK on the main thread after your application finishes launching:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ForeSee.start()
return true
}
And then check for eligibility wherever the invitation should be shown. This example shows how to check for eligibility every time the app is launched:
func applicationDidBecomeActive(_ application: UIApplication) {
ForeSeeCxMeasure.checkIfEligibleForSurvey()
}
A complete example:
import UIKit
import ForeSee
import ForeSeeCxMeasure
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ForeSee.start()
return true
}
func applicationDidBecomeActive(_ application: UIApplication) {
ForeSeeCxMeasure.checkIfEligibleForSurvey()
}
}
Scene Delegates
ForeSee iOS SDK v6.0.0 adds support for Scene Delegates, which were introduced in Xcode 11 and iOS 13.
2. Feedback
Apps that implement the Feedback module require these additional steps. First, add Feedback to your Podfile
:
pod 'ForeSee'
pod 'ForeSee/ForeSeeFeedback
Then, configure your app for Feedback. Here is a minimal sample Feedback configuration:
{
"clientId":"Ij6P1lfZHchO/co10lQ4BQ==",
"feedback":{
"feedbackSurveys":[
{
"name":"Sample 1",
"feedbackId":"AEvfwfp1vY"
}
]
},
"measures": {}
}
Finally, import Feedback, start the SDK, and show a Feedback survey:
import UIKit
import ForeSee
import ForeSeeFeedback
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ForeSee.start()
return true
}
func applicationDidBecomeActive(_ application: UIApplication) {
ForeSeeFeedbackComponent.showFeedbackSurvey()
}
}
Swift Compatibility
5.3.0 | 5.3.1 | 5.3.2 | 5.3.3 | 5.3.4 | 5.3.5 | 6.0.0+ | |
---|---|---|---|---|---|---|---|
Module Stability | ✅ | ||||||
Swift 5.1.3 (Xcode 11.3) | ✅ | ✅ | |||||
Swift 5.1.0 (Xcode 11.0) | ✅ | ||||||
Swift 5.0.0 (Xcode 10.2) | ✅ | ✅ | |||||
Swift 4.2.1 (Xcode 10.1) | ✅ |
Use this table to determine which version of Swift is supported in each version of the ForeSee SDK.
Updated over 2 years ago