I am trying to programmatically add a UINavController and UITabBarController to the home screen of my app. I feel like i've tried everything and i am royally stuck. currently my code is in the scenedelegate file but i've tried moving things to appdelegate and no success. i've tried following tutorials exactly but for some reason when i run and build it, my simulator doesn't look like the tutorials i'm following (just a blank screen) even though i'm writing the exact same code to try to add the nav and tab bars. below is the latest of what i have so far. Any help would be much appreciated. is there something i'm not considering?
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let windowScene = (scene as? UIWindowScene) else { return }
// ViewController1() ViewController2()
let mainView = UINavigationController(rootViewController: ViewController())
let VC1 = UINavigationController(rootViewController: ViewController1())
let VC2 = UINavigationController(rootViewController: ViewController2())
let tab = UITabBarController()
tab.viewControllers = [VC1, VC2, mainView]
window = UIWindow(frame: UIScreen.main.bounds)
window?.windowScene = windowScene
window?.rootViewController = tab
window?.makeKeyAndVisible()
}