views:

902

answers:

4

Xcode has these handy time savers in the scripts menu called "Code->Place Accessor Defs on Clipboard" and "Code->Place Accessor Decls on Clipboard". These scripts allow you to automate the generation of getter and setter methods for any highlighted instance variables.

Does anyone know of a similar script that outputs Objective-C 2.0 Property declaration statements?

+1  A: 

You can use the "Edit User Scripts..." menu option in the Scripts menu to create these yourself.

Ben Gottlieb
A: 

I also recommend textexpander which makes the process a little more intuitive and generalized such that the same "snippets" can be used across text editors.

wisequark
+3  A: 

Check out:

  1. Matt Gallagher's property accessors script for XCode

  2. Accessorizer if you want a whole application for the generation of property accessors.

John Gallagher
A: 

Accessorizer will generate code for your properties and it will intelligently generate the correct property specifiers (particularly if you set things in your Defaults Table) - and you can customize your output even further using the Custom Table. Accessorizer does explicit accessors, too and will automatically generate the explicit accessors if you set your ivar to dynamic. In V1.6, Accessorizer will detect IBOutlets and insert the IBOutlet keyword for you. It also has an option for self.view = nil; for your -viewDidUnload method in iPhone OS programming. Accessorizer generates keyed-archiving code, accessors for collections (indexed and unordered as in NSSet), key-validation, Singleton, locking, init methods ...

Kevin