1

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

reza23
  • 3,079
  • 2
  • 27
  • 42

1 Answers1

0

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.

reza23
  • 3,079
  • 2
  • 27
  • 42