Advertisement
srk72

Set initial ViewController from SceneDelegate file

May 19th, 2022
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.84 KB | None | 0 0
  1. //guard let _ = (scene as? UIWindowScene) else { return }
  2.        
  3.         let storyBoard = UIStoryboard(name: "Main", bundle: nil)
  4.         let firstViewController = storyBoard.instantiateViewController(withIdentifier: "LoginViewController")
  5.        
  6.         if let windowScene = scene as? UIWindowScene {
  7.                 let window = UIWindow(windowScene: windowScene)
  8.                 let navigationController = UINavigationController(rootViewController: firstViewController)
  9.             navigationController.navigationBar.isTranslucent = false
  10.             navigationController.setNavigationBarHidden(true, animated: true)
  11.             navigationController.isNavigationBarHidden = true
  12.                 window.rootViewController = navigationController
  13.                 self.window = window
  14.                 window.makeKeyAndVisible()
  15.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement