Detecting if Stage Manager is Available in SwiftUI

213 Views Asked by At

Is there anyway to detect if Stage Manager is available on an iPad from a swiftUI application. Thanks

1

There are 1 best solutions below

0
On

From some older suggestions I came up with the following solution:

var isStageManager: Bool {
    guard UIDevice.current.userInterfaceIdiom == .pad,
          let sceneDelegate = UIApplication.shared.connectedScenes.first as? UIWindowScene,
          let screenHeight = sceneDelegate.windows.last?.screen.bounds.height,
          let windowHeight = sceneDelegate.windows.last?.bounds.height else {
        return false
    }
    return screenHeight > windowHeight
}

It seems to works. Any comments will be appreciated.