Xcode 11. SceneDelegate func willConnectTo。不接受具有属性的函数

Xcode 11. SceneDelegate func willConnectTo. Not accepting a func with Properties

我想将一个 func(configureInitialViewController()) 插入到 willConnectTo 中(这样我就可以在其他 ViewController 中调用相同的 func)

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()

        }


    }

改变

func configureInitialViewController()

func configureInitialViewController(_ scene: UIScene)

并将scene传给它