A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
1.1 KiB

using Foundation;
using UIKit;
namespace Avalonia.iOS;
internal sealed class AvaloniaSceneDelegate : UIResponder, IUIWindowSceneDelegate
{
[Export("window")]
public UIWindow? Window { get; set; }
[Export("scene:willConnectToSession:options:")]
public void WillConnect(UIScene scene, UISceneSession session, UISceneConnectionOptions connectionOptions)
{
if (session.Configuration.Name is not null ||
scene is not UIWindowScene windowScene ||
Application.Current?.ApplicationLifetime is not SingleViewLifetime lifetime)
{
return;
}
Window = new UIWindow(windowScene);
InitWindow(Window, lifetime);
Window.MakeKeyAndVisible();
}
internal static void InitWindow(UIWindow window, SingleViewLifetime lifetime)
{
var view = new AvaloniaView();
lifetime.View = view;
var controller = new DefaultAvaloniaViewController { View = view };
window.RootViewController = controller;
view.InitWithController(controller);
}
}