using Foundation; using UIKit; namespace VoiceCat.iOS; [Register("SceneDelegate")] internal sealed class SceneDelegate : UIResponder, IUIWindowSceneDelegate { [Export("window")] public UIWindow? Window { get; set; } [Export("scene:willConnectToSession:options:")] public void WillConnect(UIScene scene, UISceneSession session, UISceneConnectionOptions options) { if (scene is not UIWindowScene windowScene) return; Window = new(windowScene) { RootViewController = new RootViewController(AppModel.Shared) }; Window.MakeKeyAndVisible(); } [Export("sceneDidEnterBackground:")] public void DidEnterBackground(UIScene scene) => AppModel.Shared.Save(); }