Saturday, October 14, 2023
HomeiOS Developmentswift - iOS app mirrored as a substitute of proven as exterior...

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


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 reveals a non-interactive view. I am utilizing SwiftUI. Here is how I’ve applied 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.position == .windowApplication {
        let window = UIWindow(windowScene: windowScene)
        window.rootViewController = UIHostingController(rootView: ContentView())
        window.makeKeyAndVisible()
    }
    
    if session.position == .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 here is my data.plist entry if that is related to you.

The info.plist containing the entries for the windows

Okay, so this works effective 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 machine in StreamLabs, the iPhone’s display (with the ContentView) is mirrored, as a substitute of displaying the ExternalView.

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

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



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments