I've flirted with Kevin Callahan's Accessorizer over the years. Some pretty smart programmers swear by it, and I could see on paper how it would save me time and effort. Still, I was never 100% comfortable integrating it into my workflow — until now.
With the big changes in the latest release (2.9.2 as of this writing), I find that using Accessorizer not only saves time, it feels natural. My hands stay on the keyboard, there is very little cognitive load, and I never leave Xcode. Furthermore, the dozens of things Accessorizer can do are easily available to me, and I can learn about them and add them to my workflow at my convenience.
The Copy-Paste paradigm
The key for me was to understand that Accessorizer uses a Copy-Paste paradigm:
- You select ivars in your .h file.
- You load them into Accessorizer's buffer. Conceptually, this is a Copy, except what you care about is not the literal text but the ivars' names and metadata.
- At various points in your code, you tell Accessorizer to inject
@property
statements,@synthesize
statements, etc. Conceptually, these are all variations on Paste.
The things that bothered me before boiled down to extra steps that got in the way of this paradigm (for example, having to constantly switch between Accessorizer and Xcode). Two new features cleared all those obstacles:
- The Action Menu, which appears as a status item in the menu bar and provides quick access to all the "variations on Paste".
- Auto-paste, which means the Action Menu pastes code snippets directly into Xcode.
There is an Action Panel, a floating version of the Action Menu, which I don't use but others like a lot. I prefer the Action Menu, but you should check out the Action Panel to see if you like it. Different users will prefer one or the other.
My workflow
With the Copy-Paste paradigm in mind, here's how I use Accessorizer:
- I select ivars in my .h file.
- I load them into Accessorizer with Control-;, which I have mapped to the "Declaration" Service. This means not only does Accessorizer load the ivars into its internal buffer, it prefills the Cocoa clipboard with
@property
statements. - I use regular Command-V to paste the
@property
statements where I want them. - I navigate to the point in my .m file where I want
@synthesize
statements. - I use one keyboard shortcut to pull down the Action Menu and another to select "Implementation", which pastes the corresponding
@synthesize
statements. - If there are other things I want to paste, I get them from the Action Menu, again using keyboard shortcuts.
The Action Menu is brilliant because once I've learned the keyboard shortcut to pull it down, all of its options are available via ordinary keystrokes — "2" for "Implementation", "4" for "Dealloc", etc. The menu has captured keyboard focus, so I don't have to worry about conflicts with the million key bindings in Xcode 3 or the billion in Xcode 4. This is well worth the slight cost in having to use two keystrokes instead of one. I'd go so far as to say the extra keystroke is a feature, not a cost.
The one shortcoming of the Action Menu is the hotkey to open it: Shift-Control-Command-0. It requires a lot of fingers, is hard to remember, and isn't configurable. If you have a utility like Keyboard Maestro or Butler, you can specify some other keystroke as a macro for Shift-Control-Command-0. I use Control-'. [EDIT: I added a screenshot of the Action Menu.]
Customizing
I should mention that it's not only the new features in Accessorizer that make 2.9.2 a breakthrough version for me. It also took some work to figure out how I want to use it and what to ignore. For example, I ignore all the Services it offers except "Declaration":
As far as I am concerned, the other Services are a distraction. All I want is one keyboard shortcut to copy ivars into Accessorizer, and "Declaration" makes the most sense because @property
statements are what I'm most likely to want next. From that point on, I go to the Action Menu to do my "variations on Paste".
(As you can imagine if you've tried Xcode 4, Kevin had a hard time finding a keystroke that wasn't taken. Fortunately, I don't mind stealing a keystroke back from Xcode — in this case Control-;, which would normally be mapped to "Check Spelling". It's very easy for me to hit, especially with the Caps Lock key mapped to Control, and it's easy to remember Control-' for the Action Menu since the apostrophe is right next to the semicolon.)
I also ignore most of Accessorizer's features, for now. Within its main window, with its massive array of configuration options, the two tabs I care about most are "General" and "Coding Style". Within the "General" tab all I care about is turning off the Action Panel and turning on the Action Menu:
Within the "Coding Style" tab I mostly care about the "ivar Prefix" box and the "Formatting" box. The rest I can get to over time, as I surely will.
This was a useful summary, as I'm currently evaluating this tool. Thanks for publishing.