CARVIEW |
Xcode 1.5 is the newest version of Apple's Integrated Development Environment (IDE), and this latest release is available for download from the ADC Member Site. This new version (as of August, 2004) of Xcode introduces several compelling new features, including the ability to reduce the size of deployed applications with dead-code stripping, enhancements to the user interface, additions to source code management support, and code completion. Already a popular tool for developers targeting Mac OS X for their Cocoa, Carbon, or Java applications, Xcode has long provided many of the best features of project editing, search and navigation, file editing, project building, and debugging facilities for all types of Mac OS X software projects, in a wide range of programming languages, including C, C++, Objective C, Objective C++ and Java. Advanced features include predictive compilation, where the compiler is working on your code while you are still making edits. Fix and Continue allows you to make changes to applications running in the debugger; just do a quick save and recompile and you see the change reflected in the still-running application. Xcode takes advantage of Bonjour, to locate and use other nearby Macs running Xcode to speed up your work with a distributed build. This article highlights some of the key new features of Xcode 1.5, so you can start using them right away. Lightening the LoadWe'll start this discussion of Xcode 1.5 at the very end of your software development process. When it comes time to ship your application, are you shipping more than you need to? You may need to link to a library but only want to take advantage of some small portion of it. New in Xcode 1.5 is the ability to strip out some of the unnecessary code by enabling dead-code stripping. Open a project in the Xcode IDE. Open the Get Info window for the project by double-clicking on the project group, select the Styles tab and check Dead-Code Stripping. You should see something like what appears in Figure 1.
Figure 1: Lightening the Load by Stripping Unused Code. Dead code stripping removes uncalled code that isn't dynamically linked. It's a characteristic of Objective C—and in many ways, a strength—that that you cannot always determine which code will be called at run time. Now, whenever you can determine during the build that some methods and classes will not be used, you can strip these pieces out. This reduces the size and memory requirements of your application. The benefit? Your users can download your apps more quickly and run them in more constrained environments. See the in-depth look at Dead-Code Stripping in the Xcode Build System topic section of the online documentation. Enhanced InterfaceWhen you opened Xcode 1.5, you probably noticed the enhanced user interface. Some of the items have been moved around a bit while others have been grouped together so that they can be more easily found. For example, see the Window menu shown in Figure 2.
Figure 2:The Enhanced Xcode 1.5 User Interface. The Tools submenu makes the secondary windows all reachable from here as well as from within the task-related menu items: Run Log, SCM, and so on. So you can open the detailed build window from Window > Tools > Build Results, from Build > Detailed Build Results, or by using the keyboard shortcut. At the top level, you can see that there is now a global activity viewer that you can use to monitor what Xcode is doing. Also, when you bring up the secondary window for Build Results, Debugger, Project Find or others, you see the new attached editors. To see this, perform a project search as shown in Figure 3; you can edit the source code in the results returned by the search right in the editor window attached to the Project Find window. Just select the result you wish to edit and it will appear in the attached edit window.
Figure 3: Editors Attached to Secondary Windows. Whether you are adding an existing source file, framework, jar file, or other resource to your project, you can now use the Project > Add to Project menu item. When you double-click on a group, it expands the group, and when you double-click on the project, Xcode now brings up the Get Info window for the project. You now find buttons for adding or removing splits in the main project view. Once you have the project interface working the way you want you can use the Window > Defaults... menu item to store the current settings as your defaults for future projects.
Regardless of the size of your projects, you are going to enjoy the performance enhancements in the text editor. Large files load more quickly and the editor is more responsive. You can move through parts of words in text files using Control-Left-Arrow and Control-Right-Arrow. For example, in Figure 3, in the line More Sense in Code SenseCreate a new project in Xcode 1.5 and notice what isn't there anymore. Indexing now occurs on a background thread so you can continue to work while the project is being indexed. When you create a new project you don't have to sit and watch the names of the files being indexed flash by before getting work. After all, you seldom need code completion or to be exploring the class browser in your first moments of working on a project anyways. If you wish, you can still monitor the progress of the indexing, as shown in Figure 4. It is now displayed in the Activity Viewer.
Figure 4: Indexing Projects Takes Place in a Background Thread.
Java developers are going to appreciate the introduction of code completion for Java to Xcode 1.5. In addition, class and source files inside of jar or zip files can now be indexed. Add a jar to a Java project using the Project > Add to Project menu item or by right-clicking in Groups and Files and selecting Add > Existing Files.... You can see this newly added jar being indexed in the Activity Viewer. In Figure 5, the file
Figure 5: Code Completion Now Includes Java From Source, class, or jar files Use the Code Sense tab in the Project Info box to configure code completion to Always show list when completing, as shown in Figure 6. The return type and argument types are also shown for the suggested method.
Figure 6: The Code Sense Tab in the Project Info box (partial view).
Even prior to version 1.5 you could index your Xcode projects from the command line using Subversive ChangesIn Xcode 1.5, you now have more options when choosing a Source Code management System. Along with CVS and Perforce, Subversion is joining the supported SCM systems on Mac OS X. If the code repository is going to live on another machine you only need to install the client. Untar the Subversion package from the Subversion home page. After you untar the files, read the directions for the client installation. If you are going to host the repository on your own machine you will also need to download and install the Berkeley DB. Double-click on the project to open up the Get Info window. At the bottom you will find a pull-down menu labeled SCM. Select Subversion and select the Enable SCM checkbox. You have to use the command line to check out the project the first time. After that you can add, remove, update, log, status compare, diff, annotate, and update to a specific version from Xcode. In the SCM window, as in the project window, you can see the SCM status on the left. For example, the letter M indicates local modifications, the letter A means that the file is scheduled for addition into the repository, and ? is used to flag files that are not under source control. As you see in Figure 7, you can view code in the SCM window using the attached editor pane.
Figure 7: Viewing a Project in Subversion With an Attached Editor Pane. Remote DebuggingFor those times when it simply isn't practical to debug an application on the machine on which it is running, Xcode 1.5 introduces remote debugging. Imagine that you are creating a full-screen application such as a game; in such a case, a debugger window would either be obscured by the application you are testing or, if it were brought to the front, it would hide some portion of the application. Or, if you are debugging the event handling in a GUI application, it is hard to both send events to the application being tested and to the debugger. The solution in both cases is remote debugging. To enable remote debugging, select the executable from within Xcode and double-click it to open an inspector window, as shown in Figure 8. Choose the Debugging tab and then select the Debug executable remotely via SSH checkbox. You should also select Pipe from the pulldown menu used to select your conduit for standard input/output.
Figure 8: Enabling Remote Debugging with Xcode 1.5 The machines involved in the remote debugging session will need to use SSH public key authentication, so you have to set that up beforehand. The document Remote Debugging in Xcode walks you through the necessary steps. SummaryThere are additional improvements and additional features in Xcode 1.5 that cannot be covered in this article. For example, a new inspector has been added to for project item comments with clickable links to URLs and e-mail addresses and AppleScript now correctly supports jumping to a specified line. Download the latest version of Xcode 1.5 and note the increase in your productivity. For More InformationSee the Xcode User's Guide and other documents that are available in Tools section of the ADC Reference Library: Updated: 2005-04-29 |
![]() ![]() |
Get information on Apple products. Copyright © 2008 Apple Inc. |
![]() |