Last active
April 15, 2020 01:21
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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