diff options
| author | Tomáš Znamenáček | 2014-08-07 10:26:20 +0200 | 
|---|---|---|
| committer | Tomáš Znamenáček | 2015-01-07 15:42:21 +0100 | 
| commit | 756601488fe195b0b14a8ac9c3c418140d5845f0 (patch) | |
| tree | 06f00fd43bbce43386049260b3145ec1fdf46f8d /Framework | |
| parent | be9358bf32dc402f3bc77c6cc20957047ab363af (diff) | |
| download | MASShortcut-756601488fe195b0b14a8ac9c3c418140d5845f0.tar.bz2 | |
Binding options can now be customized for MASShortcutBinder.
This makes it possible to customize the way the shortcuts are stored
in user defaults. The default options call for the keyed archiver
transformer, deserializing the shortcuts from NSData.
Diffstat (limited to 'Framework')
| -rw-r--r-- | Framework/MASShortcutBinder.h | 1 | ||||
| -rw-r--r-- | Framework/MASShortcutBinder.m | 4 | 
2 files changed, 3 insertions, 2 deletions
| diff --git a/Framework/MASShortcutBinder.h b/Framework/MASShortcutBinder.h index 74842f3..3cd54dd 100644 --- a/Framework/MASShortcutBinder.h +++ b/Framework/MASShortcutBinder.h @@ -3,6 +3,7 @@  @interface MASShortcutBinder : NSObject  @property(strong) MASShortcutMonitor *shortcutMonitor; +@property(copy) NSDictionary *bindingOptions;  - (void) bindShortcutWithDefaultsKey: (NSString*) defaultsKeyName toAction: (dispatch_block_t) action;  - (void) breakBindingWithDefaultsKey: (NSString*) defaultsKeyName; diff --git a/Framework/MASShortcutBinder.m b/Framework/MASShortcutBinder.m index 0de99db..2b30157 100644 --- a/Framework/MASShortcutBinder.m +++ b/Framework/MASShortcutBinder.m @@ -16,6 +16,7 @@      [self setActions:[NSMutableDictionary dictionary]];      [self setShortcuts:[NSMutableDictionary dictionary]];      [self setShortcutMonitor:[MASShortcutMonitor sharedMonitor]]; +    [self setBindingOptions:@{NSValueTransformerNameBindingOption: NSKeyedUnarchiveFromDataTransformerName}];      return self;  } @@ -31,9 +32,8 @@  - (void) bindShortcutWithDefaultsKey: (NSString*) defaultsKeyName toAction: (dispatch_block_t) action  {      [_actions setObject:[action copy] forKey:defaultsKeyName]; -    NSDictionary *bindingOptions = @{NSValueTransformerNameBindingOption: NSKeyedUnarchiveFromDataTransformerName};      [self bind:defaultsKeyName toObject:[NSUserDefaultsController sharedUserDefaultsController] -        withKeyPath:[@"values." stringByAppendingString:defaultsKeyName] options:bindingOptions]; +        withKeyPath:[@"values." stringByAppendingString:defaultsKeyName] options:_bindingOptions];  }  - (void) breakBindingWithDefaultsKey: (NSString*) defaultsKeyName | 
