Quick Start p1

 

Quick Start

1.    Generate some code

After carefully following the instructions on the Setup page, you are now ready to start generating code with ease!  Follow these next few steps and watch the short video clip. 


  1. 1.Minimize Accessorizer to the Dock to get it out of our way.


  1. 2.Launch Xcode and create a Test.h and Test.m file for practice purposes.


  1. 3.If you want, you can make Xcode FULL SCREEN.  


  1. 4.Copy and paste the following temporary ivar declarations below the @interface block (where you normally place @property statements) in your Test.h file. We’ll magically replace them with @property statements.


NSTimer *timer;

NSString *name;

float freq;

CFStringRef cfString;

NSArray *songs;

NSMutableArray *artists;

UILabel *label;

UITableView *tableView;

BOOL fast;


  1. 5.Select the block of temporary ivar declarations.


  1. 6.While the block is selected, invoke the Accessorizer Action Panel Service by pressing the following keyboard shortcut: SHIFT-OPT-CMD-0 (shift option command zero)


  1. 7.Pressing cmd-v  replaces the ivars with @property statements.
    Your output should look like this (note how Accessorizer intelligently provides @property attributes or specifiers that vary according to what is passed in).

Tap the play button to watch 7 second demo

NOTE: if you already have @property statements, you can select the @property statements and generate code from the @property statments, such as @synthesize and other code.  Accessorizer handles both ivars and properties as the input source.


DISCUSSION: How did this work?


First, during the Setup instructions, you did several important things:


1) Turned ON and set the Accessorizer Action Panel Service to the keyboard shortcut:  shift-opt-cmd-0 (shift option command zero). You can set that shortcut to whatever you want, but I’ve chosen this one because Xcode 4 is not using it.  You need to make sure whatever you choose for this shortcut is not already in use by Xcode 4, otherwise, the Accessorizer Action Panel Service will not be available to you via the shortcut and you will wonder why your code selection in Xcode is not being “serviced” by  Accessorizer.  Also note: Mac OS X Services only become available upon selection of text or an object to be serviced.  ie: when you want Accessorizer to service some code, you must first select the code you want serviced, then invoke the Accessorizer Action Panel Service via the keyboard shortcut.


2) Enabled several settings in the General TAB that affect how Accessorizer interacts with Xcode.   In the above code generation example, we found it easy to first type out some temporary ivar declarations (just the type and the ivar or property’s name followed by the semi-colon) on our way to generating @property statements.  You have to write the TYPE and NAME anyway when you write out a full @property statement manually, but Accessorizer can do all that for you.   Accessorizer will intelligently fill out your property specifiers and attributes, including IBOutlets, based on your settings.  In our General Tab settings, we enabled Xcode activation upon service completion.  We also defined our default ACTION to be “Declaration”, which in Objective-2.0 using properties, that action will generate your @property statements for you.


Because we had defined the default action to be “Declaration”, Accessorizer automatically generates @properties for you simply by invoking the Accessorizer Action Panel Service keyboard shortcut:  shift-opt-cmd-0 (shift option command zero) . The results are put  on the pasteboard, so all you need to so is paste, and since we wanted to REPLACE our temporary ivar declarations with @property statements, we simply pasted over the currently selected ivars.  When requesting up any of the other 35+ code generation actions provided by Accessorizer, we’ll need to invoke the Action Menu or Action Panel via Accessorizer’s (hard-wired) Global Hotkey defined as: shift-ctrl-cmd-0 (shift control command zero).  Now you see why I’ve chosen the keyboard combinations that I have.  There are really only TWO easy keyboard combinations to learn:

Accessorizer Action Panel Service:


                    shift-opt-cmd-0 (shift option command zero)


Accessorizer’s Global Hotkey for Action Menu or Action Panel:


                    shift-ctrl-cmd-0 (shift control command zero)

The Accessorizer Action Panel Service shortcut is used to take the code you have selected in Xcode and send it over to Accessorizer to be serviced. A key point to remember: whenever you have new ivars or properties or methods to work on, you need to select that new material and send it over to Accessorizer by invoking the Accessorizer Action Panel Service.  If, on the other hand, you are generating various types of code based on the same properties or ivars that you’ve just sent to Accessorizer, you can simply call up whatever code generation actions you need.


The Accessorizer Global Hotkey (which we enabled when we turned on Universal Access’s “Enable access for assistive devices”) is currently hard-wired.  You can’t change it (yet).  It is used to open the Action Menu at your mouse pointer’s current position whereupon you can invoke other code generation actions via keyboard shortcuts that are visible to you when the menu appears.  And, because our settings have enabled Xcode activation after service invocation and automatic-paste at Xcode’s insertion point, all you need to do is move your cursor to the appropriate place in your code, open the action menu, then trigger an action via a keyboard shortcut. The results will be inserted at your current insertion point in Xcode.


The next segment will walk you through exactly how to invoke the Action Menu and trigger actions which will automatically insert the results into your Xcode file at Xcode’s insertion point.

3 Basic Steps to generating code

  1. 1)Select code and invoke Accessorizer Action Panel Service

  2. 2)Show Action Menu

  3. 3)Select action

Note: if generating additional code on same ivars or properties, you just need 2 steps, #2, #3

Quick video demo