xcode_property_from_ivar
xcode_property_from_ivar copied to clipboard
Xcode user script to create a property from an ivar
h1. Xcode property from ivar
This is 99.9% the very handy script from "Cocoa with Love":http://cocoawithlove.com/2008/12/instance-variable-to-synthesized.html . All that I've added is support for underscore naming of ivars (which will generate a synthesize with an alias), an explicit "assign" declaration for non-pointer types (just because I like it), and generation of a release in the dealloc method (or a new dealloc method if there isn't one already) for pointer types.
h1. Installation Instructions
Open Xcode, go to Scripts menu, select Edit User Scripts
Add a new shell script (I put it under the "Code" section)
Double-click the name to change it ("Generate Property" is what I use)
Double-click the cmd column to set a hotkey (cmd-shift-p is what I use -- I had to restart for this to be picked up)
Select "Entire Document" for Input
Select "Home Directory" for Directory
Select "Discard Output" for Output
Select "Display in Alert" for Errors
Clear out the existing script
Paste the contents of PropertyFromInstanceVariable.pl into the script area
h1. Usage Instructions