How to show dock menu for Catalyst apps?

I've added Mac support to my iOS app and would like to add menu items when right clicking on the app icon. I was already using app shortcuts on iOS. I have a static item defined in my info.plist under the UIApplicationShortcutItems key. and I have dynamic actions I setup in applicationWillEnterForeground. Sometimes these actions appear when right clicking the app icon but most of the time they don't. Is there an example project or best practice to get this working?

applicationWillEnterForeground is probably the wrong trigger to refresh your dynamic items. Catalyst applications get these lifecycle notifications at different times from their iOS counterparts. There is no guarantee that your application will be raised to the foreground when its Dock menu is shown. It is also quite likely that your app will already be in the foreground state (e.g. if any windows are visible on screen).

For a summary of the Catalyst lifecycle behavior, check out this WWDC2019 talk (starting from minute 27) as well as this WWDC2020 talk (starting from minute 8).

How to show dock menu for Catalyst apps?
 
 
Q