- July 3, 2025
- Mins Read
Warning UIMenuController
is deprecated from iOS 16. Use UIEditMenuInteraction
instead.
MenuItemKit
provides image and block(closure) support for UIMenuItem
.
MenuItemKit
is a Swift project but Objective-C is supported without any doubt.
Add this repo URL to your Swift package dependencies.
pod ‘MenuItemKit’, ‘~> 4.0.0’
MenuItemKit
repository as a submodule of your application’s repository.MenuItemKit.xcodeproj
into your application’s Xcode project or workspace.MenuItemKit.framework
to the “Embedded Binaries” section.If you would prefer to use Carthage, please pull request.
MenuItemKit
is very easy to adopt, it provides only 2 APIs:
typealias MenuItemAction = (UIMenuItem) -> ()
extension UIMenuItem {
convenience init(title: String, image: UIImage?, action: MenuItemAction)
convenience init(title: String, action: MenuItemAction)
}
For Objective-C, MenuItemKit
provides prefixed API names for safe reasons:
@interface UIMenuItem (SWIFT_EXTENSION(MenuItemKit))
– (nonnull instancetype)mik_initWithTitle:(NSString * _Nonnull)title image:(UIImage * _Nullable)image action:(MenuItemAction _Nonnull)action;
– (nonnull instancetype)mik_initWithTitle:(NSString * _Nonnull)title action:(MenuItemAction _Nonnull)action;
@end
Just init UIMenuItem
s 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.
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.
If you want to have a custom camera using SwiftUI and not using the UIPickerController that will display the original ...
CameraView allows you to have a SnapChat-style screen on your SwiftUI app that gives a realtime view of the iPhone ...
SwiftUI has proven to be a really awesome new framework to build and design apps in a quick and reliable ...
See the swiftui branch for updates. An iOS calendar library for displaying calendar events in a week view.