Swift + SwiftUI
If your application is written in Swift and uses SwiftUI as the entry point to the UI, follow these steps:
Open the main entry point of your application, which is annotated with
@main
and contains yourApp
instance. Add the
import PulseLabsFlightRecorderSDK
statement to the top of the file:Observe the scenePhase value in the Environment, if you are not already doing so, using
@Environment(\.scenePhase) private var scenePhase
indicated in the example below at (A). Then, check when the phase is .active using.onChange(of: scenePhase)
andif phase == .active
, as shown in the below example at (B) and (C). Finally, insert theFlightRecorderSDK.start(apiKey: "YOUR_API_KEY")
line of code so that it runs whenever the ScenePhase becomes.active
as shown below at (D), replacing "YOUR_API_KEY" with your own API key. There are also 2 other parameters that are optionals: - surveyName: if you have designed an in-app survey on the portal, then supply the unique survey name string here, and it will show that instead of the default form - customFontsLib: you can also create an instance of FlightRecorderCustomFontsLib as pass it here. The sdk then will use that font to decorate the in-app survey form with it
The SDK is now installed! Run your app on a real device (the SDK will not work in a simulator) and the introduction screen will appear on the first run. You can then shake or take a screenshot to capture the video content and send a report.
If you have any issues, head to the Troubleshooting section.
Last updated