leotumwattana / MenuOptionalPrimaryAction

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwiftUI Feature Request - Allow providing optional primaryAction to Menu

I have a certain use case where based on certain conditions, a bunch of Menu should allow triggering via primaryAction or not.

Right now, based on the current SwiftUI.Menu API, I have to use an if clause to switch between these behaviors. However, when the number of Menus are large, this is very inefficient as it'll have to render anew.

I would like to propose allowing us to set primaryAction as an optional value for this use case:

Menu(titleKey: LocalizedStringKey, content: () ->, View: (() -> Void)?)

About


Languages

Language:Swift 100.0%