Mac Catalyst and NSToolbar

I have submitted FB12157356 for an issue where Mac Catalyst does not play nicely with NSToolBar. Supposedly clickable items in the toolbar do not enable when they should. This is from the Mac Catalyst tutorial at

https://developer.apple.com/tutorials/mac-catalyst/updating-the-app-icon

Here is what I wrote:

In the tutorial

https://developer.apple.com/tutorials/mac-catalyst/updating-the-app-icon

there is the completed Catalyst xcode project (in the Complete folder).

I downloaded and ran the completed project in Xcode Version 14.2, using my Mac OS 12.6.5 to run it. The NSToolBar at the top of the window has the toolbar items for edit and favorite, but they remain greyed out and don't do anything when a recipe is selected. The selectors seem to be set properly for their actions in the ToolBarDelegate file but nothing happens when I select a recipe and the DetailViewController displays the recipe, which it appears you have to do in order for those toolbar items to work. Those buttons never appear to be enabled at all even though I have selected a recipe and the sample coding seems correct.

Steps to Reproduce:

  1. Download and open the Xcode project in the "Complete" folder from the link provided above.
  2. Run the project with Mac as the the simulator target.
  3. Select a recipe
  4. The toolbar edit icon should be enabled and should display the RecipeEditorViewController when clicked. The favorite (heart) icon should be filled if the recipe is a favorite, and allow you to favorite a recipe if it isn't already a favorite.

Interestingly, if you enable the Touch Bar when running the app from Xcode, the Touch Bar displays the edit and favorite icons correctly and the react properly to touches.

If anyone has time to look at the tutorial and any suggestion for a workaround so that the toolbar items work correctly I'd love to hear it. Catalyst has lots of potential but this apparent bug isn't helping.

Accepted Answer

I've also seen this bug. My workaround (as annoying as it is) is to create my own NSToolbar and items and enable and disable them myself as needed. Seems like the only workaround until the Catalyst devs improve the interaction between navitems and toolbaritems.

Mac Catalyst and NSToolbar
 
 
Q