Router in SceneDelegate

305 views Asked by At

I have a Router that doesn't work in new Xcode 11, it works as an appDelegate. Now I need to transition to another SCENE and I tried all issues that I found here, but it still doesn't work. Here is the code that fails to transition to the intended next scene:

class Router {

static let shared = Router()

private init() {}

private let rootViewController: UIViewController = ViewController()

func root(_ window: inout UIWindow?) {
    // need to set frame or Scene
    window?.makeKeyAndVisible()
    window?.rootViewController = rootViewController
}

}

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    guard let windowScene = (scene as? UIWindowScene) else { return }
    window = UIWindow(windowScene: windowScene)
    Router.shared.root(&window)
}
0

There are 0 answers