Xcode 11. SceneDelegate fun c willConnectTo. Не принимать удовольствие c со свойствами - PullRequest
0 голосов
/ 16 января 2020

Я хочу вставить забавный c (configureInitialViewController ()) в willConnectTo (чтобы я мог вспомнить то же самое забавное c в других ViewControllers)

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

    var window: UIWindow?


    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {

        configureInitialViewController()

}

    func configureInitialViewController() {
        if let windowScene = scene as? UIWindowScene {
            let window = UIWindow(windowScene: windowScene)
            if 1>0 {
                window.rootViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(identifier: ViewController1)
            } else {
                window.rootViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(identifier: ViewController2)
            }
            self.window = window
            window.makeKeyAndVisible()

        }


    }

1 Ответ

0 голосов
/ 16 января 2020

Изменить

func configureInitialViewController()

На

func configureInitialViewController(_ scene: UIScene)

И передать scene ему

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...