Toobar Items Not Clickable Mac Catalyst Tutorial

Hi,

I am giving Mac Catalyst a try and Apple has provided a tutorial for that but it seems a bit buggy.

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 to run it in simulation. The toolbar at the top of the window has the icons for edit and favorite but they appear to be greyed out and don't do anything when clicked. The selectors are set properly for their actions in the ToolBarDelegate file but nothing happens when I select a recipe, which it appears you have to do in order for those buttons to work, then try to click either one of those items Those buttons never appear to be enabled at all even though I have selected a recipe and the coding seems correct.

I am confused as to why this doesn't work. The NSSharingServicePickerToolbarItem is enabled and seems to work.

I didn't post any code since the project can be readily downloaded and viewed/run. Any help is much appreciated

Answered by zewkini in 760448022

I found the problem quite by accident. Adding

    func collectionView(_ collectionView: UICollectionView, canFocusItemAt indexPath: IndexPath) -> Bool {
        return false
    }

in the RecipeListViewController UICollectionViewDelegate solved the problem.

This also solved a focus ring issue that had been plaguing the list in the collection view.

Accepted Answer

I found the problem quite by accident. Adding

    func collectionView(_ collectionView: UICollectionView, canFocusItemAt indexPath: IndexPath) -> Bool {
        return false
    }

in the RecipeListViewController UICollectionViewDelegate solved the problem.

This also solved a focus ring issue that had been plaguing the list in the collection view.

Toobar Items Not Clickable Mac Catalyst Tutorial
 
 
Q