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

Ratspootin

macrumors newbie
Original poster
Jun 1, 2009
3
0
I just started learning Objective C last night so I'm completely new to it, but shouldn't Xcode 4 put braces after the view controller line when you make a new project?

This is what Xcode 4 creates by default:
http://img6.imageshack.us/img6/5504/xcode4template.jpg

This is what I'm assuming it's supposed to be based on Xcode 3 tutorials:
http://img40.imageshack.us/img40/9682/xcode4template2.jpg

Did Xcode 3 do this automatically because every video/website/book based on Xcode 3 I'm using has it there when a new project is created. :confused:
 
I just started learning Objective C last night so I'm completely new to it, but shouldn't Xcode 4 put braces after the view controller line when you make a new project?

This is what Xcode 4 creates by default:
http://img6.imageshack.us/img6/5504/xcode4template.jpg

This is what I'm assuming it's supposed to be based on Xcode 3 tutorials:
http://img40.imageshack.us/img40/9682/xcode4template2.jpg

Did Xcode 3 do this automatically because every video/website/book based on Xcode 3 I'm using has it there when a new project is created. :confused:


They are no longer needed, do not worry about it.
 
They are no longer needed, do not worry about it.

The curly braces are needed if you declare instance variables :)

http://clang.llvm.org/doxygen/ParseObjc_8cpp_source.html

http://clang.llvm.org/doxygen/ParseObjc_8cpp_source.html said:
Code:
00121 ///   objc-class-interface:
00122 ///     '@' 'interface' identifier objc-superclass[opt]
00123 ///       objc-protocol-refs[opt]
00124 ///       objc-class-instance-variables[opt]
00125 ///       objc-interface-decl-list
00126 ///     @end

00257   if (Tok.is(tok::l_brace))
00258     ParseObjCClassInstanceVariables(ClsType, tok::objc_protected, atLoc);

01111 ///   objc-class-instance-variables:
01112 ///     '{' objc-instance-variable-decl-list[opt] '}'
 
The curly braces are needed if you declare instance variables :)

http://clang.llvm.org/doxygen/ParseObjc_8cpp_source.html


Freakin IPad. LOL. Not sure why it didn't post properly. In any event, I had something that went like this.

They are no longer needed, do not worry about it. Unless of course you need instance variables in which case you will need to add the curly braces back. Apple seems to push properties. I'm guessing that apple changed the template with Xcode 4. Here is a nice overview of the header/implementation files. http://www.idev101.com/learn/objective_c_classes.html


My apologies for the confusion. [self embarrassed].
 
No worries! The extra information that you intended to post makes the original statement much clearer :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.