для iOS 13 в SceneDelegate.swift
Вы можете добавить ниже код
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
self.initiateRootViewController()
guard let _ = (scene as? UIWindowScene) else { return }
}
func initiateRootViewControlle() {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
let viewController = story.instantiateViewController(withIdentifier: "ViewController")
let windowscene = UIApplication.shared.connectedScenes.first
if let windowScene = windowscene as? UIWindowScene {
self.window = UIWindow(windowScene: windowScene)
self.window?.frame = UIScreen.main.bounds
self.window?.windowLevel = UIWindow.Level.statusBar + 1
self.window?.rootViewController = viewController
self.window?.makeKeyAndVisible()
}
}
Ниже iOS 13 добавить ниже код в AppDelegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
self.initRootController()
return true
}
func initiateRootViewControlle() {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
let viewController = story.instantiateViewController(withIdentifier: "ViewController")
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = viewController
self.window?.windowLevel = UIWindow.Level.normal
self.window?.makeKeyAndVisible()
}