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.

Post not yet marked as solved Up vote post of zewkini Down vote post of zewkini
584 views

Accepted Reply

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.

  • Thank you for your confirmation and suggestion. Apple has not responded yet. I'm pretty new to Catalyst and I was hoping there would be a simple fix. I've looked high and low on a way to implement your suggestion but it still eludes me. I've tried moving the delegation around too. It also looks The code for this tutorial is somewhat complex so if you can provide any actual coding to make it work I would be most appreciative!

  • After some more looking around and patience I finally was able to get a working toolbar. From what I've read, Catalyst has a lot of shortcomings and this is one of them. It takes a lot more work to get things working the way they should.

Add a Comment

Replies

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.

  • Thank you for your confirmation and suggestion. Apple has not responded yet. I'm pretty new to Catalyst and I was hoping there would be a simple fix. I've looked high and low on a way to implement your suggestion but it still eludes me. I've tried moving the delegation around too. It also looks The code for this tutorial is somewhat complex so if you can provide any actual coding to make it work I would be most appreciative!

  • After some more looking around and patience I finally was able to get a working toolbar. From what I've read, Catalyst has a lot of shortcomings and this is one of them. It takes a lot more work to get things working the way they should.

Add a Comment