-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(ios): multi-window support #10786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: refactor/circular-deps
Are you sure you want to change the base?
Conversation
iPad supports multiple whereas iPhone only supports 1
Testing must be done on physical iPad
|
Command | Status | Duration | Result |
---|---|---|---|
nx test apps-automated -c=android |
❌ Failed | 23m 8s | View ↗ |
nx run-many --target=test --configuration=ci --... |
✅ Succeeded | <1s | View ↗ |
☁️ Nx Cloud last updated this comment at 2025-08-25 21:34:39
UTC
…t/multi-window-support
* Additional user info from the notification. | ||
*/ | ||
userInfo?: NSDictionary<any, any>; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can likely embed ios|android keys within this interface for specific platform details and provide userInfo as a data property for both already deserialized.
What is the current behavior?
For several years, since iOS 13, a developer could manually wire up a SceneDelegate, modify plist properties and achieve multi scene support.
What is the new behavior?
With iOS 26 making multi-window support even nicer, this finally brings a powerful yet simple API to develop multi-window apps on iPadOS and beyond.
✅ Fully backwards compatible so maintains current behavior by default.
Scene lifecycle will only engage once
UIApplicationSceneManifest
is added to Info.plist, for example:When a configuration like this is detected, the app will auto switch to scene lifecycle.
Multi-Window Scene Support for NativeScript iOS
Overview
This implementation provides full support for iOS 13+ scene-based applications while maintaining backwards compatibility with traditional single-window apps.
🔧 Core Changes
1. New SceneDelegate Class
A new
@NativeClass SceneDelegate
has been created that implementsUIWindowSceneDelegate
.It is only activated when
UIApplicationSceneManifest
configuration is present in Info.plist.sceneWillConnectToSessionOptions
- Creates UIWindow and sets up scenesceneDidBecomeActive
- Handles scene activationsceneWillResignActive
- Handles scene deactivationsceneWillEnterForeground
- Scene foreground transitionsceneDidEnterBackground
- Scene background transitionsceneDidDisconnect
- Scene cleanup2. Enhanced iOSApplication
The
iOSApplication
class has been significantly enhanced with scene management capabilities:New Methods
supportsScenes()
: Checks if device supports scenessupportsMultipleScenes()
: Checks if the application supports multiple scenes (only available on physical iPadOS)getAllWindows()
: Returns all app windowsgetAllScenes()
: Returns all scenesgetWindowScenes()
: Returns window scenes specificallygetPrimaryWindow()
: Returns the primary windowgetPrimaryScene()
: Returns primary sceneisUsingSceneLifecycle()
: Checks if using scene-based lifecyclesetWindowRootView(window: UIWindow, view: View)
: Sets the root view for a specific window.3. Scene Event Support
New Interface: SceneEventData
Scene Event Constants
4. Scene Lifecycle Notification Observers
The application automatically registers for scene lifecycle notifications on iOS 13+ if the app has detected a scene manifest:
UISceneWillConnectNotification
UISceneDidActivateNotification
UISceneWillEnterForegroundNotification
UISceneDidEnterBackgroundNotification
UISceneDidDisconnectNotification
🚀 Usage Examples
Basic Scene Event Listening
Multi-Window Management
Scene-Specific UI Management
📋 Key Features
1. Multi-Window Management
2. Scene Lifecycle Events
3. Backwards Compatibility
4. Type Safety
5. Custom Scene Delegates
🔍 Technical Implementation Details
Scene Detection and Setup
SDK_VERSION >= 13
UIApplication.sharedApplication.supportsMultipleScenes
Window Management
Map<UIScene, UIWindow>
for efficient scene-to-window mappingUIWindow
instances for eachUIWindowScene
Event Forwarding
Memory Management
Error Handling
🔄 Migration Path?
For Existing Apps
No changes required - existing single-window apps will continue to work exactly as before.
For New Multi-Window Apps
Info.plist
SceneEvents
constants