So I am programming an app that performs image tracking and then displays a view. The problem is that when I dismiss the app and relaunch it, it shows the view instead of restarting the detection process. How can I make the app restart the detection process upon relaunching? how can i add parameters that make sure that the app always start with a specific view first and then get to the second view
here is the all the view and i want to always ondismiss, onrelaunch… always start with the splashView
import SwiftUI
import UIKit
@main
@MainActor
struct demo16App: App {
@State private var model = ImageTrackingModel()
@ObservedObject var viewModel = OptionsViewModel()
@ObservedObject var webSocketService = WebSocketService()
@Environment(.openWindow) private var openWindow
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
SplashView()
}.windowStyle(.plain)
ImmersiveSpace(id:"Content"){
ContentView()
.environment(model)
.handlesExternalEvents(preferring: [], allowing: [])
}.windowStyle(.plain)
ImmersiveSpace(id: "ImmersiveSpace") {
ImmersiveView()
}.windowStyle(.plain)
WindowGroup(id: "secondWindow") {
VStack {
VideoView()
.zIndex(100)
}
}
WindowGroup(id:"immersiveView"){
Text("Simple Text View")
}
WindowGroup(id: "thirdWindow") {
VStack {
SwiftUIView(
viewModel: OptionsViewModel()
).environment(model)
}
}.windowStyle(.plain)
}
}