SwiftUI
SwiftUI App Lifecycle
If your app adopts the SwiftUI App Life Cycle, the simplest approach is to launch Bugsee within the App conformer’s initializer:
import Bugsee
import SwiftUI
@main
struct BugseeSwiftUIApp: App {
init() {
let options : [String: Any] =
[ BugseeMaxRecordingTimeKey : 60,
BugseeShakeToReportKey : false,
BugseeScreenshotToReportKey : true,
BugseeCrashReportKey : true ]
Bugsee.launch(token: "<your_app_token>", options: options)
}
}
Protecting views
All system secure fields (SecureField) are hidden from the recorded video automatically. In addition we support a way to mark your custom sensitive views so they will be treated similarly, through the bugseeProtect() and bugseeProtect(isEnabled:) View extensions.
These extensions ship with the SDK in a separate BugseeSwiftUI module of the Bugsee Swift package. When adding https://github.com/bugsee/spm to your project, pick the BugseeSwiftUI library product (it also links the core Bugsee framework), then import it in the files where you use the modifiers:
import Bugsee
import BugseeSwiftUI
BugseeSwiftUI requires iOS 13.0 or later; on iOS 12 the core Bugsee module remains fully usable. The module is part of the Swift Package Manager distribution only — the CocoaPods pod and the Carthage/manual XCFramework ship the core Bugsee framework alone.
Static protection (view is always hidden):
Text(landmark.description)
.bugseeProtect()
Dynamic protection (visibility controlled by state or binding):
@State private var isHidden = false
Text(landmark.description)
.bugseeProtect(isEnabled: $isHidden)
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
isHidden = true
}
}