My Catalyst App was rejected because it does not "look nice" in Mac's full screen mode. And that is true, it's designed as a windowed App. My first thought is to disable the green zoom button, but AFAIK I need a pointer to the NSWindow object to do that, and that's not available.
Any suggestions on what to do here? I do not mind if the green button toggles the App between its max size and the last user chosen size, say, but it's not proper for the App to enter full screen mode.
Thanks,
I had the same rejection. I was subsequently able to alter the zoom functionality (or disable the green maximise button, depending on what you want to do).
I haven't submitted this yet, so can't vouch for it passing app review, but here is my solution:
1. Create a new target for your app. macOS -> Bundle. Use Objective C. Call it something like HelperBundle
2. In your main target, go to General tab, add the new bundle under "Frameworks, Libraries and Embedded Contact"
3. In your bundle, create a single class, say HelperApp:
HelperApp.h:
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface HelperApp : NSObject
+ (void) disableMaximiseButton;
@end
NS_ASSUME_NONNULL_END
HelperApp.m:
#import "HelperApp.h"
@implementation HelperApp
+ (void) disableMaximiseButton
{
for (NSWindow *window in [[NSApplication sharedApplication] windows]) {
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary|NSWindowCollectionBehaviorFullScreenNone|NSWindowCollectionBehaviorFullScreenDisallowsTiling];
NSButton *button = [window standardWindowButton:NSWindowZoomButton];
[button setEnabled: NO];
}
}
@end
4. Now you need to call it from your main app. I made a method something like this. Sorry it’s in Obj-C:
#if TARGET_OS_MACCATALYST
- (void) catalystDisableMaximiseButton
{
NSString *bundlePath = [NSBundle.mainBundle.builtInPlugInsPath stringByAppendingString:@"/HelperBundle.bundle"];
NSBundle *bundle = [[NSBundle alloc] initWithPath:bundlePath];
[bundle load];
NSObject *object = (NSObject *) NSClassFromString(@"HelperApp");
[object performSelector:NSSelectorFromString(@"disableMaximiseButton")];
}
#endif
5. Now I call it. I could only get it working by calling catalystDisableMaximiseButton in the main view controller’s “viewDidAppear” method