Xcode 4 - Braces Missing?

Discussion in 'iOS Programming' started by Ratspootin, Sep 13, 2011.

  1. Ratspootin macrumors newbie

    Joined:
    Jun 1, 2009
    #1
    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:
     
  2. Sykte macrumors regular

    Joined:
    Aug 26, 2010
    #2

    They are no longer needed, do not worry about it.
     
  3. ianray macrumors 6502

    Joined:
    Jun 22, 2010
    Location:
    @
    #3
    The curly braces are needed if you declare instance variables :)

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

     
  4. Sykte macrumors regular

    Joined:
    Aug 26, 2010
    #4

    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].
     
  5. ianray macrumors 6502

    Joined:
    Jun 22, 2010
    Location:
    @
    #5
    No worries! The extra information that you intended to post makes the original statement much clearer :)
     

Share This Page