swift – iOS app mirrored as a substitute of proven as exterior show

[ad_1]

I am implementing a characteristic in my iPhone/iPad app the place when the iPhone is linked to an exterior show, the iPhone acts as a controller and the exterior show exhibits a non-interactive view. I am utilizing SwiftUI. Here is how I’ve carried out it within the SceneDelegate, following Apple’s documentation.

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, choices connectionOptions: UIScene.ConnectionOptions) {
    guard let windowScene = scene as? UIWindowScene else { return }
    if session.function == .windowApplication {
        let window = UIWindow(windowScene: windowScene)
        window.rootViewController = UIHostingController(rootView: ContentView())
        window.makeKeyAndVisible()
    }
    
    if session.function == .windowExternalDisplayNonInteractive {
        let window = UIWindow(windowScene: windowScene)
        window.rootViewController = UIHostingController(rootView: ExternalView())
        window.makeKeyAndVisible()
    }
}

The place, after all, ContentView needs to be displayed on the iPhone and ExternalView is displayed on the exterior show. And this is my data.plist entry if that is related to you.

The info.plist containing the entries for the windows

Okay, so this works superb for many instances, like when display mirroring from my iPhone to a TV utilizing AirPlay. Each views are displayed appropriately. The issue I am having, although, is that in sure instances, like making an attempt to do a film recording in QuickTime with the iPhone because the supply or including the iPhone as a video seize system in StreamLabs, the iPhone’s display (with the ContentView) is mirrored, as a substitute of exhibiting the ExternalView.

The ExternalView wants to be proven when utilizing these apps. I am starting to fret that this isn’t doable with QuickTime and StreamLabs and never one thing I can repair on my finish.

Anyway, when you’ve got any options to this concern I’d very a lot respect any suggestions in any respect.

[ad_2]

Leave a Reply