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.
Xcode 4 no longer supports user scripts but instead uses Services.
You can create a Service with Automator.
Do the same as below except put the code in a Run Shell Script.
Set the Application to Xcode and the input as Text.
Or, use the one provided in the AutomatorService folder.
Install the gem.
I have only been able to get this working in Xcode by installing the gem in system ruby.
sudo gem install property_synthesize_dealloc sudo gem install rb-appscript
Make a user script in Xcode with the following:
#!/usr/bin/ruby require 'rubygems' require "property_synthesize_dealloc" property = PropertySynthesizeDealloc.new property.selection = STDIN.read property.psd!
Then select the ivars you wish to make property, synthesize and dealloc declarations and execute using either a user script or
if using Xcode 4, a Service (as described in the Update above and provide in the AutomatorService folder).
You can provide an optional parameter to a custom config.yml file.
Just add the path as a parameter to PropertySynthesizeDealloc.new.
Here is the skeleton. Make sure to use this as a starting point.
settings: sleep_time: 0.1 xcode_app_path: '/Developer/Applications/Xcode.app' use_nonatomic: true position_prop_after_closing_bracket: false outlet: true types: copy: ['NSString', 'NSMutableString', 'NSArray', 'NSNumber'] assign: ['int', 'integer', 'BOOL', 'float', 'NSUInteger', 'NSInteger', 'double', 'uint8_t', 'uint16_t', 'uint32_t', 'int8_t', 'int16_t', 'int32_t', 'int64_t', 'uint64_t', 'GLuint', 'GLushort', 'GLubyte', 'GLfloat', 'size_t', 'GLenum'] retain: 
Copyright (c) 2011 Craig Williams. See LICENSE.txt for further details.