Skip to content

Instantly share code, notes, and snippets.

@mahmudahsan
Last active April 15, 2020 01:21
Show Gist options
  • Save mahmudahsan/22eb64d51d02e47fbfbb3c32291b9191 to your computer and use it in GitHub Desktop.
Save mahmudahsan/22eb64d51d02e47fbfbb3c32291b9191 to your computer and use it in GitHub Desktop.
SwiftUI: How to Pop to TabView From NavigationView #3 https://thinkdiff.net/ios/swiftui-how-to-pop-to-tabview-from-navigationview/
var window: UIWindow?
var contentView: ContentView?
var appState: AppState?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
self.window = window
reloadDashboard()
}
}
func reloadDashboard() {
if let window = self.window {
window.rootViewController = UIHostingController(rootView:
contentView
.environmentObject(appState!)
)
window.makeKeyAndVisible()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment