Some favorite site feeds aggregated locally: iPhone Development RSS   Adobe Labs RSS   Macrumors RSS

Wednesday, April 1, 2009

Xcode: get alphabetized methods all the time

Wednesday, April 1, 2009   

After a bit of chatter with an Apple forum administrator, I found a way to get Xcode to do what I want in regards to it's method popup menu.

Quick overview:
I like using TextMate on the Mac for ActionScript 3 coding (it's not FlashDevelop, but it's pretty good). The method popup menu for methods is always alphabetized. Personally, I like this a lot. In FlashDevelop you can view all your methods but it's listed in the order they exist in the class file.

While using Xcode, the method popup menu can be affected by using #pragma mark to a nice effect, however the list of methods by default is in the order they exist in the class file.

After some conversation, I was informed that holding the option key down before clicking on that method menu will alphabetize the list. That's cool, but what if you don't want to remember to use the modifier key all of the time?

In the Terminal, enter this:
$ defaults write com.apple.Xcode PBXSortMethodsPopup -bool YES

Now by default that menu will be alphabetized and holding down the option key prior to selection will show you in file order. Awesome. I don't know what this does for your pragma marks, I'll have to check that tomorrow. Update: It actually ignores all set pragma marks (for now anyway).


Above: this is what you should by default after you run the Terminal command above. Remember to restart Xcode. Now, when you Option-click that menu after you'll see this:



One thing that doesn't happen is alphabetizing within pragma mark blocks themselves, although Apple has already looked into this. It would be a subtle yet nice addition to the tool.

Labels:

 
 Return to the main page
Comments:

There are currently 0 Comments:

 Leave a comment