refactor: Reduce duplication code with UIApplication.keyWindow and .topController and improve alert function

This commit is contained in:
naturecodevoid
2023-06-01 07:35:07 -07:00
parent f69ad9830a
commit 175b5bec95
9 changed files with 57 additions and 57 deletions

View File

@@ -17,14 +17,14 @@ extension UnstableFeatures {
let rootView = RootView()
.environment(\.managedObjectContext, DatabaseManager.shared.viewContext)
UIApplication.shared.keyWindow?.rootViewController = UIHostingController(rootView: rootView)
UIApplication.topController = UIHostingController(rootView: rootView)
}
static func onDisable() {
let storyboard = UIStoryboard(name: "Main", bundle: .main)
let rootVC = storyboard.instantiateViewController(withIdentifier: "tabBarController") as! TabBarController
UIApplication.shared.keyWindow?.rootViewController = rootVC
UIApplication.topController = rootVC
}
}
}