遇到不使用storyboard设置rootViewController ,根据很久之前的经验,在appdelegate中的window中设置,结果无效,然后看到了sceneDelegate这个文件,在这个方法中设置
@available(iOS 13.0, *)
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 }
self.window = UIWindow(windowScene: windowScene)
let splash = SplashViewController()
self.window?.rootViewController = splash
self.window?.makeKeyAndVisible()
}