Feature: Add the capacity to filter actions
llfbandit opened this issue · comments
The library works great but, currently we're unable to filter the actions.
In my case, I pop the menu on an UITextView and filter the available actions in target event.
Since, the selector names are generated with prefix and UUID string, we can't make matches on the selectors.
For now, as a workaround, I integrated the lib in the project and added this method:
@objc(mik_initWithTitle:image:selectorName:action:) convenience init(title: String, image: UIImage?, selectorName: String, action: @escaping MenuItemAction) { let title = image != nil ? title + imageItemIdetifier : title self.init(title: title, action: Selector(selectorName)) imageBox.value = image actionBox.value = action }
This is related to #16 and should be temporarily fixed by allowing creating MenuItemAction
with images and passing a selector instead of a escaping function.
The new 3.1.0 provide options to filter, See AutoPopupMenuContorllerDemo
for detail.