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. We provide a View extension for this (View+Bugsee.swift) with bugseeProtect() and bugseeProtect(isEnabled:) methods.

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
        }
    }