added iOS source code
[wl-app.git] / iOS / Pods / MenuItemKit / README.md
1 # MenuItemKit
2
3 `MenuItemKit` provides image and block(closure) support for `UIMenuItem`.
4
5 `MenuItemKit` is a Swift project but Objective-C is supported without any doubt.
6
7
8 ## How to use
9
10 1. Add the `MenuItemKit` repository as a submodule of your application’s repository.
11 2. Drag and drop `MenuItemKit.xcodeproj` into your application’s Xcode project or workspace.
12 3. On the “General” tab of your application target’s settings, add `MenuItemKit.framework` to the “Embedded Binaries” section.
13
14 If you would prefer to use Carthage or CocoaPods, please pull request.
15
16 `MenuItemKit` is very easy to adopt, it provides only 2 APIs:
17
18 ``` swift
19 typealias MenuItemAction = (UIMenuItem) -> ()
20
21 extension UIMenuItem {
22     convenience init(title: String, image: UIImage?, action: MenuItemAction)
23     convenience init(title: String, action: MenuItemAction)
24 }
25 ```
26
27 For Objective-C, `MenuItemKit` provides prefixed API names for safe reasons:
28
29 ```objc
30 @interface UIMenuItem (SWIFT_EXTENSION(MenuItemKit))
31 - (nonnull instancetype)mik_initWithTitle:(NSString * _Nonnull)title image:(UIImage * _Nullable)image action:(MenuItemAction _Nonnull)action;
32 - (nonnull instancetype)mik_initWithTitle:(NSString * _Nonnull)title action:(MenuItemAction _Nonnull)action;
33 @end
34 ```
35
36 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.
37
38 Check dome projects (both Swift and Objective-C are provided) for more details.
39
40 ## About Me
41
42 * Twitter: [@_cxa](https://twitter.com/_cxa)
43 * Apps available in App Store: <http://lazyapps.com>
44 * PayPal: xianan.chen+paypal 📧 gmail.com, buy me a cup of coffee if you find it's useful for you, thanks.
45
46 ## License
47
48 `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.