Xcode Text Editor Tutorial

Xcode provides iPhone developers with a text editor that color-codes the different keywords and classes in your iPhone code. Color coding helps you identify the different parts of your iPhone app, which also helps you identify bugs or syntax errors more quickly. To use the Xcode text editor, you must understand the colors for each keyword phrase.

Instructions

    • 1

      Open the Xcode software on your computer. Click the "File" menu item and click "New," then "New Project." Click "Cocoa Application" in the list of project types. Click "OK." In the next window, type a name for your new app and click "OK." Xcode opens a new template app and activates the text editor where you type your code.

    • 2

      Type a comment that describes the content in the class file. Comments are color-coded in green, and they aren't compiled with the rest of the application, so you can write any comment that helps you describe the content of the page. Add the following code to create a comment: //this is my first xcode app.

    • 3

      Create a new "Hello World" class. Classes define the different sections of your iPhone app. Each class needs a type, name and any variable members. Types are color-coded in pink. The class name is black, and classes have a dash character prefix. The following code is an example of a class that draws the main frame:
      - (id)initWithFrame:(NSRect)frame {
      //class members go here
      return self;
      }

    • 4

      Create your class members. Class members are variables within the class. Members define variables such as strings or integers. The following code is an example of a class member: static NSString *hello = @"Hello, World";. When you type this code, "static" is pink, "NSString" is blue and "Hello, World" is red.

    • 5

      Click the "Product" menu item and click "Run." This item runs the Xcode debugger and runs the code in an editor that you use to review the code for any bugs.

Related Searches:

References

Comments

Related Ads

Featured