Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pavankataria/6c84009b8c2e56c93a4475c1c078ae27 to your computer and use it in GitHub Desktop.
Save pavankataria/6c84009b8c2e56c93a4475c1c078ae27 to your computer and use it in GitHub Desktop.
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
/// 1. Capture the scene
guard let windowScene = (scene as? UIWindowScene) else { return }
/// 2. Create a new UIWindow using the windowScene constructor which takes in a window scene.
let window = UIWindow(windowScene: windowScene)
/// 3. Create a view hierarchy programmatically
let viewController = ArticleListViewController()
let navigation = UINavigationController(rootViewController: viewController)
/// 4. Set the root view controller of the window with your view controller
window.rootViewController = navigation
/// 5. Set the window and call makeKeyAndVisible()
self.window = window
window.makeKeyAndVisible()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment