views:

177

answers:

5

Hi,

I've been slowly working my way through the examples in Beginning iPhone Development and there are a few things that I have not been able to figure out, but I'm sure you guys can help me with it.

  • In Eclipse there is a Source->Generate Getters/Setters, can you do something similar to synthesize properties in Xcode
  • I also cannot seem to find a Refactor menu
  • I'm also struggling to find the equivalent to Source->Override/Implement Methods

--Edit-- I failed to describe my problem it seems. I do know that synthesizing properties will generate getters/setters for me, but I am looking for a way to generate the @property/@synthesize code, by selecting the variables.

Short list to start with, but I will probably have more as my confusion grows in might.

:)

A: 

Generating getters and setters for properties is done with the @property and the @synthesize keywords.

Edit -> Refactor

Overriding methods is just writing the method name, you don't have to add @Override like in Java.

neohaven
@neohaven - Thanks for your answer, but what I am looking for is a way of automating the generation of @property and @synthesize tags. I am not talking about adding a @override tag to methods but copying the method template into the source file :)
willcodejavaforfood
A: 

In Eclipse there is a Source->Generate Getters/Setters, can you do something similar to synthesize properties in Xcode

AFAIK there isn't such a thing in Xcode. But synthesizing ObjC properties is simple, just add

@property(retain) NSArray* my_array;

in your @interface and

@synthesize my_array;

in your @implementation, if you want to generate getters and setters for my_array.

I also cannot seem to find a Refactor menu

Edit -> Refactor (Shift-Cmd-J).

If you simply want to rename, mouse-click an identifier, wait for 1 seconds for a downward triangle to appear next to it, then click on it and choose "Edit All in Scope".

KennyTM
+1  A: 

I will ignore that question and instead answer a different question:

Here is some stuff I found useful when I first got started

And to directly address your question, check out Accessorizer

slf
Excellent, what I was looking for. I just found this as well which just deals with properties http://cocoawithlove.com/2008/12/instance-variable-to-synthesized.html
willcodejavaforfood
+1  A: 

There's no way built in Xcode to make proprieties in an automated manner.

However, user script can do this. Take a look at this article by Matt Gallagher.

gcamp
+1  A: 

I've created a list about a lot of funcrions and features in Xcode which also contains a lot of features that you are used to in Eclipse (i'm using eclipse on a daily basis) which also include thins like displaying class hierarchy, search for classes, code completion, using Xcode with svn etc..

Xcode tips: http://www.sodeso.nl/?p=674

Using Xcode with svn: sodeso.nl/?p=599

ronaldmathies
Brilliant, thanks
willcodejavaforfood