To enable Split View or Multiple Windows support on iPad and visionOS (iOS 13.0+), you must perform three configuration steps in your Xcode project:
- Add iPad Target: In your Xcode workspace, ensure iPad is added to the
Supported Destinations. - Configure Info.plist: Enable multiple scenes and disable full screen mode by adding
UIApplicationSupportsMultipleScenes and UIRequiresFullScreen keys. - Update AppDelegate.mm: Implement the
application:configurationForConnectingSceneSession:options: method using RNExternalAppDelegateUtil to manage scene configurations.
This setup creates two types of delegates:
RNExternalSceneMainDelegate: The primary app scene (ensure only one is created).RNExternalSceneDelegate: Scenes for external screens (can be multiple).
Note: The app will automatically create the main scene if it is not active, or create an external scene if connected to an external screen or if requestScene is called.
--- Info.prev.plist
+++ Info.plist
@@ -37,6 +37,13 @@
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
++ <key>UIApplicationSceneManifest</key>
++ <dict>
++ <key>UIApplicationSupportsMultipleScenes</key>
++ <true/>
++ </dict>
++ <key>UIRequiresFullScreen</key>
++ <false/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
--- AppDelegate.prev.mm
+++ AppDelegate.mm
@@ -2,6 +2,9 @@
#import <React/RCTBundleURLProvider.h>
+// Use RNExternalAppDelegateUtil
+#import "RNExternalDisplayUtils.h"
+
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
@@ -14,6 +17,19 @@
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
+- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options API_AVAILABLE(ios(13.0)) {
+ UISceneConfiguration * configuration =
+ [RNExternalAppDelegateUtil application:application
+ configurationForConnectingSceneSession:connectingSceneSession
+ options:options
+ sceneOptions:@{
+ @"headless": @NO
+ }
+ ];
+ // You can put custom configuration here
+ return configuration;
+}
+
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG