Root view controller

Root view controller represents first window that visible to the user.

Typically it is UINavigationController that defines a stack-based scheme for navigating hierarchical content.

You can specify root controller in your Main.storyboard. By default Xcode will generate an initial view controller for you and set it to be the root view controller.

Also you can programmatically set the root view controller in the scene delegate (IOS 13+).

func scene(_ scene: UIScene, 
           willConnectTo session: UISceneSession, 
           options connectionOptions: UIScene.ConnectionOptions) {
        
    window = self.window ?? UIWindow()
    window?.backgroundColor = .white
    window?.rootViewController = ViewController()
    window?.makeKeyAndVisible()
        
    guard let _ = (scene as? UIWindowScene) else { return }
}

Before iOS 13 you can set the root controller in the application delegate.

var window: UIWindow?

func application(_ application: UIApplication, 
                 didFinishLaunchingWithOptions launchOptions: 
                     [UIApplication.LaunchOptionsKey: Any]?) 
                 -> Bool {
    // ...
    
    // set the window size to the screen size
    window = UIWindow(frame: UIScreen.main.bounds)
        
    // set initial (root) view controller
    window?.rootViewController = ViewController()
        
    // show th window
    window?.makeKeyAndVisible()
    
    return true
}