1

I'm adding an "Open in New Window" context menu item which opens one of my app's documents in a new UIScene. Of course, I only want to show that menu item on devices which actually support multiple scenes.

Currently I'm just checking if the device is an iPad using good old:

if UIDevice.current.userInterfaceIdiom == .pad

Is there a more precise way of checking whether the device supports this specific capability?

Jon Colverson
  • 2,986
  • 1
  • 24
  • 24
  • 1
    From the documentation: *"In iOS 13 and later, users can create multiple copies of your app’s UI and toggle between them in the app switcher. On iPad, users can also display one copy of your app’s UI side by side with another copy."* So any device running iOS 13 supports multiple scenes. iPads add the ability to show two scenes side by side. – rmaddy Jul 12 '19 at 06:38
  • Huh, that's interesting, thank you. On iPhone simulators I get an error when using `UIApplication.requestSceneSessionActivation(_:userActivity:options:errorHandler:)` saying that it isn't allowed on that device type, so I wonder if there's another way of creating new scenes on iPhone, or if it just isn't implemented yet in the betas. – Jon Colverson Jul 12 '19 at 16:08

1 Answers1

8

Check UIApplication property supportsMultipleScenes.

Use the connectedScenes property to determine whether multiple scenes are present.

More info from official documentation here

Fabiosoft
  • 1,141
  • 14
  • 32