Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Creates the @property, @synthensize and dealloc for ivars

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 AutomatorService
Octocat-spinner-32 lib
Octocat-spinner-32 pkg
Octocat-spinner-32 spec
Octocat-spinner-32 .rvmrc
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 property_synthesize_dealloc.gemspec
README.markdown

Description

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.

Update March 19, 2011

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.

Instructions

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).

Overriding defaults

You can provide an optional parameter to a custom config.yml file.
Just add the path as a parameter to PropertySynthesizeDealloc.new.

PropertySynthesizeDealloc.new("/path/to/custom/config.yml")

Here is the skeleton. Make sure to use this as a starting point.
Supported options.

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

Copyright (c) 2011 Craig Williams. See LICENSE.txt for further details.

Something went wrong with that request. Please try again.