我有一个不能在新的Xcode 11中使用的路由器,它可以与Ann appDelegate一起使用。现在,我需要设置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)
}