Skip to content

Commit 0e9dff2

Browse files
[xcode26.0] Update UIKit bindings to Xcode 26.0 Beta 3 (#23350)
* Adds Xcode 26.0 UIKit Bindings up to beta 3 * Partially fixes #23058 * Needs fixing of actual unit test we just disabled CA1422 will be done in a separated PR * Needs fixing of macOS template, will be done along the AppKit bindings --------- Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
1 parent 41430c7 commit 0e9dff2

File tree

36 files changed

+1614
-1170
lines changed

36 files changed

+1614
-1170
lines changed

dotnet/Templates/Microsoft.MacCatalyst.Templates/maccatalyst/csharp/AppDelegate.cs

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,24 @@ namespace MacCatalystApp1;
22

33
[Register ("AppDelegate")]
44
public class AppDelegate : UIApplicationDelegate {
5-
public override UIWindow? Window {
6-
get;
7-
set;
8-
}
9-
105
public override bool FinishedLaunching (UIApplication application, NSDictionary? launchOptions)
116
{
12-
// create a new window instance based on the screen size
13-
Window = new UIWindow (UIScreen.MainScreen.Bounds);
14-
15-
// create a UIViewController with a single UILabel
16-
var vc = new UIViewController ();
17-
vc.View!.AddSubview (new UILabel (Window!.Frame) {
18-
BackgroundColor = UIColor.SystemBackground,
19-
TextAlignment = UITextAlignment.Center,
20-
Text = "Hello, Mac Catalyst!",
21-
AutoresizingMask = UIViewAutoresizing.All,
22-
});
23-
Window.RootViewController = vc;
7+
// Override point for customization after application launch.
8+
return true;
9+
}
2410

25-
// make the window visible
26-
Window.MakeKeyAndVisible ();
11+
public override UISceneConfiguration GetConfiguration (UIApplication application, UISceneSession connectingSceneSession, UISceneConnectionOptions options)
12+
{
13+
// Called when a new scene session is being created.
14+
// Use this method to select a configuration to create the new scene with.
15+
// "Default Configuration" is defined in the Info.plist's 'UISceneConfigurationName' key.
16+
return new UISceneConfiguration ("Default Configuration", connectingSceneSession.Role);
17+
}
2718

28-
return true;
19+
public override void DidDiscardSceneSessions (UIApplication application, NSSet<UISceneSession> sceneSessions)
20+
{
21+
// Called when the user discards a scene session.
22+
// If any sessions were discarded while the application was not running, this will be called shortly after 'FinishedLaunching'.
23+
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
2924
}
3025
}

dotnet/Templates/Microsoft.MacCatalyst.Templates/maccatalyst/csharp/Info.plist

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,22 @@
3131
</array>
3232
<key>XSAppIconAssets</key>
3333
<string>Assets.xcassets/AppIcon.appiconset</string>
34+
<key>UIApplicationSceneManifest</key>
35+
<dict>
36+
<key>UIApplicationSupportsMultipleScenes</key>
37+
<false/>
38+
<key>UISceneConfigurations</key>
39+
<dict>
40+
<key>UIWindowSceneSessionRoleApplication</key>
41+
<array>
42+
<dict>
43+
<key>UISceneConfigurationName</key>
44+
<string>Default Configuration</string>
45+
<key>UISceneDelegateClassName</key>
46+
<string>SceneDelegate</string>
47+
</dict>
48+
</array>
49+
</dict>
50+
</dict>
3451
</dict>
3552
</plist>

dotnet/Templates/Microsoft.MacCatalyst.Templates/maccatalyst/csharp/Resources/LaunchScreen.xib

Lines changed: 0 additions & 43 deletions
This file was deleted.

dotnet/Templates/Microsoft.MacCatalyst.Templates/maccatalyst/csharp/SceneDelegate.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,24 @@ public class SceneDelegate : UIResponder, IUIWindowSceneDelegate {
99
[Export ("scene:willConnectToSession:options:")]
1010
public void WillConnect (UIScene scene, UISceneSession session, UISceneConnectionOptions connectionOptions)
1111
{
12-
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
13-
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
14-
// This delegate does not imply the connecting scene or session are new (see UIApplicationDelegate `GetConfiguration` instead).
12+
// Use this method to optionally configure and attach the UIWindow 'Window' to the provided UIWindowScene 'scene'.
13+
// Since we are not using a storyboard, the 'Window' property needs to be initialized and attached to the scene.
14+
// This delegate does not imply the connecting scene or session are new (see UIApplicationDelegate 'GetConfiguration' instead).
15+
if (scene is UIWindowScene windowScene) {
16+
Window ??= new UIWindow (windowScene);
17+
18+
// Create a 'UIViewController' with a single 'UILabel'
19+
var vc = new UIViewController ();
20+
vc.View!.AddSubview (new UILabel (Window!.Frame) {
21+
BackgroundColor = UIColor.SystemBackground,
22+
TextAlignment = UITextAlignment.Center,
23+
Text = "Hello, Mac Catalyst!",
24+
AutoresizingMask = UIViewAutoresizing.All,
25+
});
26+
27+
Window.RootViewController = vc;
28+
Window.MakeKeyAndVisible ();
29+
}
1530
}
1631

1732
[Export ("sceneDidDisconnect:")]

dotnet/Templates/Microsoft.MacCatalyst.Templates/maccatalyst/visualbasic/AppDelegate.vb

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,22 @@ Namespace MacCatalystApp1
66
Public Class AppDelegate
77
Inherits UIApplicationDelegate
88

9-
Public Overrides Property Window As UIWindow
10-
119
Public Overrides Function FinishedLaunching(ByVal application As UIApplication, ByVal launchOptions As NSDictionary) As Boolean
12-
' create a new window instance based on the screen size
13-
Window = new UIWindow(UIScreen.MainScreen.Bounds)
14-
15-
' create a UIViewController with a single UILabel
16-
Dim vc = new UIViewController()
17-
Dim label = new UILabel(Window.Frame) With {
18-
.BackgroundColor = UIColor.SystemBackground,
19-
.TextAlignment = UITextAlignment.Center,
20-
.Text = "Hello, Mac Catalyst",
21-
.AutoresizingMask = UIViewAutoresizing.All
22-
}
23-
vc.View.AddSubview(label)
24-
Window.RootViewController = vc
25-
26-
' make the window visible
27-
Window.MakeKeyAndVisible()
28-
10+
' Override point for customization after application launch.
2911
Return True
3012
End Function
13+
14+
Public Overrides Function GetConfiguration(ByVal application As UIApplication, ByVal connectingSceneSession As UISceneSession, ByVal options As UISceneConnectionOptions) As UISceneConfiguration
15+
' Called when a new scene session is being created.
16+
' Use this method to select a configuration to create the new scene with.
17+
' "Default Configuration" is defined in the Info.plist's 'UISceneConfigurationName' key.
18+
Return New UISceneConfiguration("Default Configuration", connectingSceneSession.Role)
19+
End Function
20+
21+
Public Overrides Sub DidDiscardSceneSessions(ByVal application As UIApplication, ByVal sceneSessions As NSSet(Of UISceneSession))
22+
' Called when the user discards a scene session.
23+
' If any sessions were discarded while the application was not running, this will be called shortly after 'FinishedLaunching'.
24+
' Use this method to release any resources that were specific to the discarded scenes, as they will not return.
25+
End Sub
3126
End Class
3227
End Namespace

dotnet/Templates/Microsoft.MacCatalyst.Templates/maccatalyst/visualbasic/Info.plist

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,22 @@
2222
</array>
2323
<key>XSAppIconAssets</key>
2424
<string>Assets.xcassets/AppIcon.appiconset</string>
25+
<key>UIApplicationSceneManifest</key>
26+
<dict>
27+
<key>UIApplicationSupportsMultipleScenes</key>
28+
<false/>
29+
<key>UISceneConfigurations</key>
30+
<dict>
31+
<key>UIWindowSceneSessionRoleApplication</key>
32+
<array>
33+
<dict>
34+
<key>UISceneConfigurationName</key>
35+
<string>Default Configuration</string>
36+
<key>UISceneDelegateClassName</key>
37+
<string>SceneDelegate</string>
38+
</dict>
39+
</array>
40+
</dict>
41+
</dict>
2542
</dict>
2643
</plist>

dotnet/Templates/Microsoft.MacCatalyst.Templates/maccatalyst/visualbasic/Resources/LaunchScreen.xib

Lines changed: 0 additions & 43 deletions
This file was deleted.

dotnet/Templates/Microsoft.MacCatalyst.Templates/maccatalyst/visualbasic/SceneDelegate.vb

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,27 @@ Namespace MacCatalystApp1
1010
Public Overrides Property Window As UIWindow
1111

1212
Public Overrides Sub WillConnect(ByVal scene As UIScene, ByVal session As UISceneSession, ByVal connectionOptions As UISceneConnectionOptions)
13-
' Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
14-
' If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
15-
' This delegate does not imply the connecting scene or session are new (see UIApplicationDelegate `GetConfiguration` instead).
13+
' Use this method to optionally configure and attach the UIWindow 'Window' to the provided UIWindowScene 'scene'.
14+
' Since we are not using a storyboard, the 'Window' property needs to be initialized and attached to the scene.
15+
' This delegate does not imply the connecting scene or session are new (see UIApplicationDelegate 'GetConfiguration' instead).
16+
If TypeOf scene Is UIWindowScene Then
17+
Dim windowScene As UIWindowScene = CType(scene, UIWindowScene)
18+
If Window Is Nothing Then
19+
Window = New UIWindow(windowScene)
20+
End If
21+
22+
' Create a 'UIViewController' with a single 'UILabel'
23+
Dim vc As New UIViewController()
24+
vc.View.AddSubview(New UILabel(Window.Frame) With {
25+
.BackgroundColor = UIColor.SystemBackground,
26+
.TextAlignment = UITextAlignment.Center,
27+
.Text = "Hello, Mac Catalyst!",
28+
.AutoresizingMask = UIViewAutoresizing.All
29+
})
30+
31+
Window.RootViewController = vc
32+
Window.MakeKeyAndVisible()
33+
End If
1634
End Sub
1735

1836
Public Overrides Sub DidDisconnect(ByVal scene As UIScene)

dotnet/Templates/Microsoft.iOS.Templates/ios-tabbed/AppDelegate.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ namespace iOSTabbedApp1;
44
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
55
public class AppDelegate : UIResponder, IUIApplicationDelegate {
66

7-
[Export ("window")]
8-
public UIWindow? Window { get; set; }
9-
107
[Export ("application:didFinishLaunchingWithOptions:")]
118
public bool FinishedLaunching (UIApplication application, NSDictionary? launchOptions)
129
{

dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/AppDelegate.cs

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,24 @@ namespace iOSApp1;
22

33
[Register ("AppDelegate")]
44
public class AppDelegate : UIApplicationDelegate {
5-
public override UIWindow? Window {
6-
get;
7-
set;
8-
}
9-
105
public override bool FinishedLaunching (UIApplication application, NSDictionary? launchOptions)
116
{
12-
// create a new window instance based on the screen size
13-
Window = new UIWindow (UIScreen.MainScreen.Bounds);
14-
15-
// create a UIViewController with a single UILabel
16-
var vc = new UIViewController ();
17-
vc.View!.AddSubview (new UILabel (Window!.Frame) {
18-
BackgroundColor = UIColor.SystemBackground,
19-
TextAlignment = UITextAlignment.Center,
20-
Text = "Hello, iOS!",
21-
AutoresizingMask = UIViewAutoresizing.All,
22-
});
23-
Window.RootViewController = vc;
7+
// Override point for customization after application launch.
8+
return true;
9+
}
2410

25-
// make the window visible
26-
Window.MakeKeyAndVisible ();
11+
public override UISceneConfiguration GetConfiguration (UIApplication application, UISceneSession connectingSceneSession, UISceneConnectionOptions options)
12+
{
13+
// Called when a new scene session is being created.
14+
// Use this method to select a configuration to create the new scene with.
15+
// "Default Configuration" is defined in the Info.plist's 'UISceneConfigurationName' key.
16+
return new UISceneConfiguration ("Default Configuration", connectingSceneSession.Role);
17+
}
2718

28-
return true;
19+
public override void DidDiscardSceneSessions (UIApplication application, NSSet<UISceneSession> sceneSessions)
20+
{
21+
// Called when the user discards a scene session.
22+
// If any sessions were discarded while the application was not running, this will be called shortly after 'FinishedLaunching'.
23+
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
2924
}
3025
}

0 commit comments

Comments
 (0)