Just init UIMenuItems with above APIs, and set them to menuItems of UIMenuItemController. MenuItemKit will take care of the rest parts, you don’t need to add any code related to responder chain in your view or view controller.
Check dome projects (both Swift and Objective-C are provided) for more details.
Advance Usage
For menu items out of your control, you can use static func installTo(responder: UIResponder, shouldShowForAction: @escaping (Selector, Bool) -> Bool = default) to configure items visibility. Check AutoPopupMenuControllerDemo.
PayPal: xianan.chen+paypal 📧 gmail.com, buy me a cup of coffee if you find it’s useful for you, thanks.
License
MenuItemKit is released under the MIT license. In short, it’s royalty-free but you must keep the copyright notice in your code or software distribution.
MenuItemKit
MenuItemKitprovides image and block(closure) support forUIMenuItem.MenuItemKitis a Swift project but Objective-C is supported without any doubt.Install
Swift Package
Add this repo URL to your Swift package dependencies.
CocoaPods
Xcode subproject
MenuItemKitrepository as a submodule of your application’s repository.MenuItemKit.xcodeprojinto your application’s Xcode project or workspace.MenuItemKit.frameworkto the “Embedded Binaries” section.If you would prefer to use Carthage, please pull request.
How to use
MenuItemKitis very easy to adopt, it provides only 2 APIs:For Objective-C,
MenuItemKitprovides prefixed API names for safe reasons:Just init
UIMenuItems with above APIs, and set them tomenuItemsofUIMenuItemController.MenuItemKitwill take care of the rest parts, you don’t need to add any code related to responder chain in your view or view controller.Check dome projects (both Swift and Objective-C are provided) for more details.
Advance Usage
For menu items out of your control, you can use
static func installTo(responder: UIResponder, shouldShowForAction: @escaping (Selector, Bool) -> Bool = default)to configure items visibility. Check AutoPopupMenuControllerDemo.About Me
License
MenuItemKitis released under the MIT license. In short, it’s royalty-free but you must keep the copyright notice in your code or software distribution.