如何查看当前iOS设备是否支持多个scenes/windows?

How to check if the current iOS device supports multiple scenes/windows?

我正在添加一个 "Open in New Window" 上下文菜单项,它可以在新的 UIScene 中打开我的应用程序文档之一。当然,我只想在实际支持多场景的设备上显示那个菜单项。

目前我只是在检查设备是否是 iPad 使用旧的:

if UIDevice.current.userInterfaceIdiom == .pad

是否有更精确的方法来检查设备是否支持此特定功能?

检查 UIApplication 属性 supportsMultipleScenes.

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

来自官方文档的更多信息here