maui icon indicating copy to clipboard operation
maui copied to clipboard

Convert all uses of UICommand to UIAction

Open PureWeen opened this issue 3 years ago • 2 comments

Description

Currently for Menu's on Catalyst we are using UICommand's which requires selectors. This leads to a lot of awkward extra code. It appears that we can just use UIAction instead.

PureWeen avatar Aug 10 '22 20:08 PureWeen

One thing I'm not sure of is that with the selector stuff and UICommand, it might be easier to integrate with the default MacOS menus that nearly every app has, like File/Edit/View. I'm not sure if that works with UIAction. Definitely something to consider.

Eilon avatar Aug 10 '22 21:08 Eilon

I did a basic test just plopping in UIAction instead of UICommand and it seems like it works

AFAICT the only difference between the two is that one uses a closure and the other uses a selector

image

Still haven't found anything indicating the why of doing one vs the other. The one advantage I could see with UICommand is that the actions all execute through the MauiAppDelegate menu override so in theory a user could hook into that for every menu item even ones they've added

PureWeen avatar Aug 10 '22 22:08 PureWeen