// // SceneDelegate.swift // suixinkan_ios // // Created by hanqiu on 2026/6/26. // import UIKit /// 窗口 Scene 代理,负责创建根窗口并挂载会话协调器。 class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? /// 持有会话协调器,确保登录后切换 window 根控制器时仍能响应登出等阶段变化。 private var sessionRootController: RootViewController? /// Scene 连接时初始化窗口、重置 UI 测试状态并展示根控制器。 func scene( _ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions ) { guard let windowScene = scene as? UIWindowScene else { return } AppUITestLaunchState.resetIfNeeded() let rootViewController = RootViewController() sessionRootController = rootViewController let window = UIWindow(windowScene: windowScene) window.rootViewController = rootViewController window.makeKeyAndVisible() self.window = window } /// Scene 断开连接,当前无额外资源释放。 func sceneDidDisconnect(_ scene: UIScene) { } /// Scene 进入活跃态,当前无额外处理。 func sceneDidBecomeActive(_ scene: UIScene) { } /// Scene 即将失活,当前无额外处理。 func sceneWillResignActive(_ scene: UIScene) { } /// Scene 即将进入前台,当前无额外处理。 func sceneWillEnterForeground(_ scene: UIScene) { } /// Scene 进入后台,当前无额外处理。 func sceneDidEnterBackground(_ scene: UIScene) { } }