Avatar ·

How to programmatically set the initial view controller in Storyboard?

Hi everyone! I'm a beginner in iOS development and use Swift. I have a Storyboard with several View Controllers. By default, I set the arrow on LoginViewController in the Storyboard so it launches first. But now I need the app to check if the user is authorized, and depending on that, show either LoginViewController or MainViewController. I know you can change the initial controller in the Storyboard settings, but that's static. How do I do this programmatically? I tried to do something in `AppDelegate`, but I don't understand how to properly access the Storyboard and set the desired controller. Here's my current code in `AppDelegate`: ```swift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchO