Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Vortec4800

macrumors member
Original poster
Apr 15, 2008
34
0
Is there a way to get Xcode to generate getter and setter methods for a bunch of instance variables? I've got around 20 of em and it's sure tedious to do it for each class...
 

Spike099

macrumors regular
Feb 18, 2007
143
0
Canada
There are a couple of methods to achieve this.

First and Recommended.
Synthesizing, it would be best to read about this in the documentation.

Second, if you just want a quick and dirty way to do it(the old way), however this could be used with dynamic synthesizing aswell.
In the menu bar in Xcode, you'll see a script menu. Highlight the variables that you would like the getter setter methods for, select script menu -> code -> Place accessor Decls on Clipboard / Place accessor Defs on Clipboard

Then paste into your interface and implementation files appropriately.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.