From 46aa323115c2ebe7128aba39c0296634d232bbf6 Mon Sep 17 00:00:00 2001 From: Tomáš Znamenáček Date: Thu, 7 Aug 2014 12:55:59 +0200 Subject: Added a simplified binding API for MASShortcutView. This returns the associatedUserDefaultsKey property used in previous code versions, only the implementation uses less magic. --- Framework/MASShortcutView+Bindings.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Framework/MASShortcutView+Bindings.h (limited to 'Framework/MASShortcutView+Bindings.h') diff --git a/Framework/MASShortcutView+Bindings.h b/Framework/MASShortcutView+Bindings.h new file mode 100644 index 0000000..b0148e7 --- /dev/null +++ b/Framework/MASShortcutView+Bindings.h @@ -0,0 +1,25 @@ +#import "MASShortcutView.h" + +/** + @brief 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 + and read, here’s a simpler option. + + Setting the @p 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 + automatically. + + Set @p associatedUserDefaultsKey to @p nil to disconnect the binding. +*/ +@interface MASShortcutView (Bindings) + +@property(copy) NSString *associatedUserDefaultsKey; + +- (void) setAssociatedUserDefaultsKey: (NSString*) newKey withTransformer: (NSValueTransformer*) transformer; +- (void) setAssociatedUserDefaultsKey: (NSString*) newKey withTransformerName: (NSString*) transformerName; + +@end -- cgit v1.2.3