You can do this by adding a second UIApplicationSceneManifest
to your Info.plist
, with -macos
added to it, with different settings than for the iOS/iPadOS target. For example:
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
</dict>
<key>UIApplicationSceneManifest-macos</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
</dict>
This plist will allow support for multiple scenes on macOS, but not iPadOS.
Additionally, you can prevent new windows from being created through the file menu by removing the new scene button. Add this code to your App Delegate.
- (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder {
[builder removeMenuForIdentifier:UIMenuNewScene];
}
Using platform-specific keys is not documented anywhere, but @stroughtonsmith has made developers aware that it works.