diff options
| author | Tomáš Znamenáček | 2015-01-09 11:24:53 +0100 |
|---|---|---|
| committer | Tomáš Znamenáček | 2015-01-09 11:24:53 +0100 |
| commit | 6165e6685928c383a9dbdc8e40752eb9506944cc (patch) | |
| tree | 72c1a5457d16d3316cc707ae5f42c80b454ab315 | |
| parent | 1707e06678c1d3eca45f5763720364b3481d3a86 (diff) | |
| download | MASShortcut-6165e6685928c383a9dbdc8e40752eb9506944cc.tar.bz2 | |
Added a note about Shortcut Recorder compatibility (#54).
| -rw-r--r-- | README.md | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -42,6 +42,15 @@ self.shortcutView.associatedUserDefaultsKey = kPreferenceGlobalShortcut; You can see a real usage example in the Demo target. Enjoy! +# Shortcut Recorder Compatibility + +By default, MASShortcut uses a different User Defaults storage format incompatible with Shortcut Recorder. But it’s easily possible to change that, so that you can replace Shortcut Recorder with MASShortcut without having to migrate the shortcuts previously stored by your apps. There are two parts of the story: + +1. If you bind the recorder control (`MASShortcutView`) to User defaults, set the Value Transformer field in the Interface Builder to `MASDictionaryTransformer`. This makes sure the shortcuts are written in the Shortcut Recorder format. +2. If you use `MASShortcutBinder` to automatically load shortcuts from User Defaults, set the `bindingOptions` accordingly: + [[MASShortcutBinder sharedBinder] setBindingOptions:@{NSValueTransformerNameBindingOption:MASDictionaryTransformerName}]; + This makes sure that the shortcuts in the Shortcut Recorder format are loaded correctly. + # Notifications By registering for KVO notifications from `NSUserDefaultsController`, you can get a callback whenever a user changes the shortcut, allowing you to perform any UI updates, or other code handling tasks. |
