Open Source Component Extending UIMenuItem With Image Support And A Blocks Based Syntax

Some time ago I mentioned Chen Xian-an’s UIMenuItem+CXAImageSupport library that extends UIMenuItem using swizzling to add support for images.

Here’s an open source component submitted by Chen Xian-an that updates UIMenuItem+CXAImageSUpport called MenuItemKit that extends UIMenuItem with support for images along with a nice blocks based syntax that works with both Swift and Objective-C.

Here’s a code snippet showing how to use an image with UIMenuItem with MenuItemKit

let image = UIImage(named: "Image")!
let imageItem = UIMenuITem(image: image) { [weak self] _ in
  self?.showAlertWithTitle("image item tapped")

You can find MenuItemKit on Github here.

A nice extension to UIMenuItem.

Original article: Open Source Component Extending UIMenuItem With Image Support And A Blocks Based Syntax

©2016 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *