Как go вернуться к контроллеру rootview в swift 5, где вместо Appdelegate доступен scenedelegate
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 _ = (scene as? UIWindowScene) else { return }
if let windowScene = scene as? UIWindowScene {
self.window = UIWindow(windowScene: windowScene)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewController =
storyboard.instantiateViewController(withIdentifier: "first_page")
self.window!.rootViewController = initialViewController
self.window!.makeKeyAndVisible()
}
}
это мой код сцены scenedelegate, который необходимо отклонить / открыть для моей первой страницы.
У меня есть первая страница в Main.storyboard , но моя функция выхода из системы находится в другой раскадровке под названием Home.storyboard
пыталась
self.view.window?.rootViewController?.dismiss(animated: true, completion: nil)
и
self.navigationController?.popToRootViewController(animated: true)
Но не работает, у меня есть только один навигационный контроллер, предназначенный для первого viewcontroller