From 1094fd9a612a3d02109b04346ee17da75c701449 Mon Sep 17 00:00:00 2001 From: Tomáš Znamenáček Date: Thu, 7 Aug 2014 18:20:37 +0200 Subject: Added header documentation. --- Framework/MASShortcutBinder.h | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'Framework/MASShortcutBinder.h') diff --git a/Framework/MASShortcutBinder.h b/Framework/MASShortcutBinder.h index 98e01c7..1592e90 100644 --- a/Framework/MASShortcutBinder.h +++ b/Framework/MASShortcutBinder.h @@ -1,13 +1,57 @@ #import "MASShortcutMonitor.h" +/** + @brief Binds actions to user defaults keys. + + If you store shortcuts in user defaults (for example by binding + a @p MASShortcutView to user defaults), you can use this class to + connect an action directly to a user defaults key. If the shortcut + stored under the key changes, the action will get automatically + updated to the new one. + + This class is mostly a wrapper around a @p MASShortcutMonitor. It + watches the changes in user defaults and updates the shortcut monitor + accordingly with the new shortcuts. +*/ @interface MASShortcutBinder : NSObject +/** + @brief A convenience shared instance. + + You may use it so that you don’t have to manage an instance by hand, + but it’s perfectly fine to allocate and use a separate instance instead. +*/ + (instancetype) sharedBinder; +/** + @brief The underlying shortcut monitor. +*/ @property(strong) MASShortcutMonitor *shortcutMonitor; + +/** + @brief Binding options customizing the access to user defaults. + + As an example, you can use @p NSValueTransformerNameBindingOption to customize + the storage format used for the shortcuts. By default the shortcuts are converted + from @p NSData (@p NSKeyedUnarchiveFromDataTransformerName). Note that if the + binder is to work with @p MASShortcutView, both object have to use the same storage + format. +*/ @property(copy) NSDictionary *bindingOptions; +/** + @brief Binds given action to a shortcut stored under the given defaults key. + + In other words, no matter what shortcut you store under the given key, + pressing it will always trigger the given action. +*/ - (void) bindShortcutWithDefaultsKey: (NSString*) defaultsKeyName toAction: (dispatch_block_t) action; + +/** + @brief Disconnect the binding between user defaults and action. + + In other words, the shortcut stored under the given key will no longer trigger an action. +*/ - (void) breakBindingWithDefaultsKey: (NSString*) defaultsKeyName; /** -- cgit v1.2.3