Я пытаюсь переключить экраны после автоматического входа в мой делегат сцены, и все работает, за исключением того, что мой экран запуска отображается примерно на 10 мс, а затем он переходит в мой ViewController (начальный контроллер просмотра), а затем переключает экраны на экран, который я хочу на него переключиться. Моя цель состоит в том, чтобы экран запуска отображался все время, пока я вхожу в систему делегата сцены, а затем переключаю экраны после завершения входа. Это код, который я использую
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).
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
if KeychainWrapper.standard.string(forKey: "email") != nil && KeychainWrapper.standard.string(forKey: "password") != nil {
Auth.auth().signIn(withEmail: KeychainWrapper.standard.string(forKey: "email")!, password: KeychainWrapper.standard.string(forKey: "password")!) { (result, error) in
if error == nil {
if Auth.auth().currentUser!.isEmailVerified {
/*getting data*/
window.rootViewController = storyboard.instantiateViewController(identifier: "ViewingScreenController")
self.window = window
window.makeKeyAndVisible()
}
}
}
}
}
// guard let _ = (scene as? UIWindowScene) else { return }
}```