
As you program, Xcode automatically indents lines so that they fall either directly under the previous line or as appropriate to the structure of the statements you are writing.Ĭode within conditional blocks and loops, for example, are indented farther than surrounding code to visually show that they are a cohesive block. Auto-IndentationĬlean code is easier to read and easier to maintain, and Xcode works behind the scenes to keep your code nicely formatted through auto-indention. You can adjust the code completion options in the Xcode preferences within the Text Editing section. Doing so displays the autocomplete pop-up dialog with all the potential matches wherever your cursor is located-as if the rest of the line does not exist. If you have already finished typing (or autocompleted) a line in your code and discover that it is not what you want, you can click anywhere within the line and then choose Editor, Show Completions (Control+Spacebar) or press Escape.
#CHANGE XCODE IDE COLOR MAC OS X#
LISTING 6.1 A Short Sample Mac OS X Application 1: - ( void)applicationDidFinishLaunching:( NSNotification *)aNotificationģ: // Insert code here to initialize your application 4: NSTextField *myMessage Ħ: myMessage= init] ħ: myMessage.
#CHANGE XCODE IDE COLOR UPDATE#
Start a new line immediately following the existing comment “Insert code here to initialize your application.” Update the method as shown in Listing 6.1. Using the Source Editor, start entering the following text to implement the applicationDidFinishLaunching method. For our sample application, click the AppDelegate.m file, as shown in Figure 6.2. The editable contents of the file are shown in the Editor area of the Xcode interface. To edit code in Xcode, use the Project Navigator to find the file you want to work on, and then click the filename. Nothing earth shattering, but you’ll find it handy to keep this open so that you can test the tools as you read.įIGURE 6.1 Create a new Mac OS X Cocoa application. We’ll edit this so that it displays a simple message (Hello Xcode) in the application’s window. To follow along with this hour’s lesson, create a new project called HelloXcode using the Mac OS X Cocoa Application template and the configuration shown in Figure 6.1. The Xcode Source Editor works just like any text editor, with several additions that may make your life easier.
#CHANGE XCODE IDE COLOR HOW TO#
I am not going to bore you with details on how to move your cursor or copy and paste. Let’s be serious: If you’re learning how to program in Xcode, you know how to edit a text file. Even if you have played around with editing files already, you’re still likely to find a few undiscovered tricks in this hour.

You learn how the Source Editor can help you write clean, well-formatted code and even identify problems before you even try to run your application. This hour walks through the different Source Editor features-from automatic code completion to code refactoring.

You’ve got your project and files now how about editing them? What we have not touched on, however, is the Xcode Source Editor itself, which you use to edit, unsurprisingly, source code.

Over the past few hours, you have learned how to create projects, add files, add frameworks, and do much of the work necessary to successfully build you own application projects. Ways to find and correct errors before your app even runs.The use of pragma marks to identify different pieces of code.
