diff options
| -rw-r--r-- | Framework/MASShortcutView+Bindings.h | 14 | ||||
| -rw-r--r-- | Framework/MASShortcutView.m | 2 | ||||
| -rw-r--r-- | README.md | 11 |
3 files changed, 19 insertions, 8 deletions
diff --git a/Framework/MASShortcutView+Bindings.h b/Framework/MASShortcutView+Bindings.h index b0148e7..8cc84df 100644 --- a/Framework/MASShortcutView+Bindings.h +++ b/Framework/MASShortcutView+Bindings.h @@ -1,19 +1,19 @@ #import "MASShortcutView.h" /** - @brief A simplified interface to bind the recorder value to user defaults. + A simplified interface to bind the recorder value to user defaults. - You can bind the @p shortcutValue to user defaults using the standard - @p bind:toObject:withKeyPath:options: call, but since that’s a lot to type + You can bind the `shortcutValue` to user defaults using the standard + `bind:toObject:withKeyPath:options:` call, but since that’s a lot to type and read, here’s a simpler option. - Setting the @p associatedUserDefaultsKey binds the view’s shortcut value + Setting the `associatedUserDefaultsKey` binds the view’s shortcut value to the given user defaults key. You can supply a value transformer to convert - values between user defaults and @p MASShortcut. If you don’t supply - a transformer, the @p NSUnarchiveFromDataTransformerName will be used + values between user defaults and `MASShortcut`. If you don’t supply + a transformer, the `NSUnarchiveFromDataTransformerName` will be used automatically. - Set @p associatedUserDefaultsKey to @p nil to disconnect the binding. + Set `associatedUserDefaultsKey` to `nil` to disconnect the binding. */ @interface MASShortcutView (Bindings) diff --git a/Framework/MASShortcutView.m b/Framework/MASShortcutView.m index 74e14de..d521880 100644 --- a/Framework/MASShortcutView.m +++ b/Framework/MASShortcutView.m @@ -188,7 +188,7 @@ NSString *const MASShortcutBinding = @"shortcutValue"; - (void)drawRect:(CGRect)dirtyRect { if (self.shortcutValue) { - [self drawInRect:self.bounds withTitle:NSStringFromMASKeyCode(self.recording ? kMASShortcutGlyphEscape : kMASShortcutGlyphDeleteLeft) + [self drawInRect:self.bounds withTitle:NSStringFromMASKeyCode(self.recording ? kMASShortcutGlyphEscape : kMASShortcutGlyphClear) alignment:NSRightTextAlignment state:NSOffState]; CGRect shortcutRect; @@ -95,6 +95,17 @@ _observableKeyPath = [@"values." stringByAppendingString:kPreferenceGlobalShortc context:kGlobalShortcutContext]; ``` +# Using in Swift projects + + 1. Install as a Pod using the latest CocoaPods with Swift support. + 2. Create a bridging header file [using the instructions here](http://swiftalicio.us/2014/11/using-cocoapods-from-swift/) + 3. Your bridging header file should contain the following [two](https://github.com/shpakovski/MASShortcut/issues/36) imports: + +```objective-c +#import <Cocoa/Cocoa.h> +#import <MASShortcut/Shortcut.h> +``` + # Non-ARC Version If you like retain/release, please check out these forks: [heardrwt/MASShortcut](https://github.com/heardrwt/MASShortcut) and [chendo/MASShortcut](https://github.com/chendo/MASShortcut). However, the preferred way is to enable the `-fobjc-arc` in Xcode source options. |
