Created
August 4, 2022 09:52
-
-
Save aryasurya21/fb42c63d3dc1b58ca437f6b47827b71d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SceneDelegate.swift | |
// MyAwesomeApp | |
// | |
// Created by digital.aurum on 10/06/22. | |
// | |
import UIKit | |
import Catalog | |
import Shared | |
import ProductDetail | |
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
var window: UIWindow? | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. | |
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene. | |
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). | |
guard let windowScene = (scene as? UIWindowScene) else { return } | |
let window = UIWindow(windowScene: windowScene) | |
self.window = window | |
let rootNavigationController = UINavigationController(rootViewController: CatalogPageViewController()) | |
window.rootViewController = rootNavigationController | |
window.makeKeyAndVisible() | |
Router.route = { destination in | |
switch destination { | |
case let .productDetailPage(product): | |
let productController = ProductDetailPageViewController(product: product) | |
UIApplication.topViewController()?.navigationController?.pushViewController(productController, animated: true) | |
} | |
} | |
} | |
//rest of the code | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment