0

My Mac Catalyst app is built on Monterey 12.6.3 with Xcode 14.2 for minimum macOS Catalina 11.2. The Main menu is defined in the Main.storyboard and has a customized File menu with 3 inline sections. When the app runs in Catalina or Monterey the File menu looks like this:

enter image description here

But when the App runs on Ventura the File menu looks like this:

enter image description here

All of my inline menu items are missing in Ventura and I have not found any modification of the Main Menu in the storyboard which will make the missing items appear in Ventura. The Main Menu looks like this in the storyboard:

enter image description here

My question is: How can I modify the Storyboard definition of Main Menu so that the menus are the same in Monterey and Ventura?

I believe it is possible to build my menus with the App Delegate override buildMenuWithBuilder function, but I would like to know why the storyboard definitions no longer work across macOS Catalina to Ventura!

1 Answers1

0

Since I was unable to get an answer to this question, I decided to rebuild the menu with the App Delegate override buildMenuWithBuilder():

#if TARGET_OS_UIKITFORMAC
// Fix Issue #009 - Unusable File menu on Ventura                               //leg20230209 - MultiNotes_Catalyst_v1
//  Build File Menu from code instead of using storyboard.
- (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder
{
    [super buildMenuWithBuilder: builder];
    
    // Remove unwanted menus.
    [builder removeMenuForIdentifier:UIMenuServices];
    [builder removeMenuForIdentifier:UIMenuFormat];
    [builder removeMenuForIdentifier:UIMenuClose];
    [builder removeMenuForIdentifier:UIMenuPrint];
    [builder removeMenuForIdentifier:UIMenuFind];

    // NOOP this call when compiling on Catalina and Xcode 12.4 because
    //  macCatalyst 16.0 SDK not available.
#if BUILDING_ON_MONTEREY
    if (@available(macCatalyst 16.0, *)) {
        [builder removeMenuForIdentifier:UIMenuDocument];
    }
#endif
    
    // Build inline "New" menu section.
    UIKeyCommand* newNoteCommand = [UIKeyCommand keyCommandWithInput:@"N" modifierFlags:UIKeyModifierCommand action:@selector(newNoteMenuCMD:)];
    newNoteCommand.title = @"New Note";
    newNoteCommand.discoverabilityTitle = @"Create a new Note in selected Group";

    UIKeyCommand* newGroupCommand = [UIKeyCommand keyCommandWithInput:@"G" modifierFlags:UIKeyModifierCommand+UIKeyModifierShift action:@selector(newGroup)];
    newGroupCommand.title = @"New Group";
    newGroupCommand.discoverabilityTitle = @"Create a new Group in selected Group";

    UIKeyCommand* deleteNoteOrGroupCommand = [UIKeyCommand keyCommandWithInput:@"\b" modifierFlags:UIKeyModifierCommand action:@selector(deleteNoteOrGroup:)];
    deleteNoteOrGroupCommand.title = @"Delete Note or Group";
    deleteNoteOrGroupCommand.discoverabilityTitle = @"Delete selected Note or Group";

    UIKeyCommand* duplicateNoteCommand = [UIKeyCommand keyCommandWithInput:@"R" modifierFlags:UIKeyModifierCommand action:@selector(duplicateNote:)];
    duplicateNoteCommand.title = @"Duplicate Note";
    duplicateNoteCommand.discoverabilityTitle = @"Duplicate selected Note";

    UIMenu* newMenu = [UIMenu menuWithTitle:@"" image:nil identifier:@"com.tropic4.multinotes.newmenu" options: UIMenuOptionsDisplayInline children: @[newNoteCommand, newGroupCommand, deleteNoteOrGroupCommand, duplicateNoteCommand]];
    [builder insertChildMenu: newMenu atStartOfMenuForIdentifier: UIMenuFile];

    
    // Build inline "Import" menu section.
    UIKeyCommand* importNotesCommand = [UIKeyCommand keyCommandWithInput:@"" modifierFlags:0 action:@selector(importNotes:)];
    importNotesCommand.title = @"Import Notes…";
    importNotesCommand.discoverabilityTitle = @"Import selected .txt, .html, and .rtf note files from selected folder";     //leg20230220 - MultiNotes_Catalyst_v1

    UIKeyCommand* exportNoteAsHTMLCommand = [UIKeyCommand keyCommandWithInput:@"E" modifierFlags:UIKeyModifierCommand action:@selector(exportNoteAsHTML:)];
    exportNoteAsHTMLCommand.title = @"Export Note As HTML…";
    exportNoteAsHTMLCommand.discoverabilityTitle = @"Export Note as an HTML file";

    UIKeyCommand* exportNoteAsRTFCommand = [UIKeyCommand keyCommandWithInput:@"E" modifierFlags:UIKeyModifierCommand+UIKeyModifierShift action:@selector(exportNoteAsRTF:)];
    exportNoteAsRTFCommand.title = @"Export Note As RTF…";
    exportNoteAsRTFCommand.discoverabilityTitle = @"Export Note as an RTF file";

    UIMenu* importMenu = [UIMenu menuWithTitle:@"" image:nil identifier:@"com.tropic4.multinotes.importmenu" options: UIMenuOptionsDisplayInline children: @[importNotesCommand, exportNoteAsHTMLCommand, exportNoteAsRTFCommand]];
    [builder insertChildMenu: importMenu atEndOfMenuForIdentifier: UIMenuFile ];

    
    // Build inline "Print" menu section.
    UIKeyCommand* printNoteCommand = [UIKeyCommand keyCommandWithInput:@"P" modifierFlags:UIKeyModifierCommand action:@selector(printNote:)];
    printNoteCommand.title = @"Print…";
    printNoteCommand.discoverabilityTitle = @"Print selected Note";
    
    UIMenu* printMenu = [UIMenu menuWithTitle:@"" image:nil identifier:@"com.tropic4.multinotes.printmenu" options: UIMenuOptionsDisplayInline children: @[printNoteCommand]];
    [builder insertChildMenu: printMenu atEndOfMenuForIdentifier: UIMenuFile ];
}