When using applicationWillTerminate, which is executed when the application is terminated in swiftui, I want to call a method in the @EnvironmentObject object instantiated in the view, but I don't know how to do it. How should I do this?
class AppDelegate: UIResponder, UIApplicationDelegate, ObservableObject{
func applicationWillTerminate(_ application: UIApplication) {
//I want to use @EnvironmentObject in view here!!!!
}
}
}