Login

Objective-C Method Name Formatter

Formatting an Objective-C method putting each parameter on its own line.

Xcode User Script Settings

 

Twitter - Follow 140 Tech Experts - The easy way!

Earlier today someone posted a Tweet to an article titled "140 tech experts to follow on Twitter, updated for 2010." Sounds like a good idea to me. I'm a geek, so these people should be tweeting about things I am interested in. I want to follow all 140 but I do not want to do that manually. That would take a long time.

Automation to the Rescue

In about five minutes, I whipped up this script that did it for me. The script ran in just a few seconds and I am now following all 140.

 

Create @property, @synthesize & dealloc from Variable Declaration [video]

Drastically Improved on 2010-03-07

UPDATE: 2010-03-07 Updated to write the @synthesize and dealloc declarations to the .m file as well as place the @property declaration just below the closing bracket in the .h file. I have been testing it all day and have had no issues with it. Please let me know if you have an suggestions or find a bug. UPDATE: 2010-03-10 Updated to work on Leopard.
Leopard, concerning Apple Events, is a little flaky. If you encounter any issues, please report them.
UPDATE: 2010-03-12 Updated to choose between adding the @property declarations after the closing bracket "}" in the @implementation or just before the closing @end.
Set this preference to true for the bracket and false for @end.
@position_prop_after_closing_bracket = false

One of the things we do a lot of in Objective-C is outlet and variable declaration, synthesize and dealloc. Since this is a repeatable recurring event I thought I would add a little automation to the process.

This updated script has a few preferences. One is @thread_safe. If set to true, the "nonatomic" value will be used. If set to false, it will not. The others are for memory management. Add class names to the corresponding array for @copy, @assign and @retain for default assignments for those classes. This isn't a hugh amount of preferences but it does allow some flexibility.

The most significant improvement is that it now writes the @synthesize and dealloc declarations for you in the .m file. It also positions the @property declarations just below the closing bracket in the .h file. It does not create a dealloc declaration for anything that you list in the @assign array.

Requirements / Dependencies

The script is dependent on rb-appscript. The easiest way to install this is with Ruby gems.
sudo gem install rb-appscript

 

Edit Xode Document in TextMate User Script

This Xcode User Script will open the current Xcode document in TextMate.
Below are the Xcode settings.
 
 

Product Categories

Welcome

Welcome to AllanCraig.net and thanks for visiting. Here you will find articles, tips and tricks, tutorials and video training. Video training is only now beginning to be produced so check back often for new releases.