Appendix A: Using Xcode's Tools and Utilities

In This Appendix

Understanding tools and utilities
Introducing Dashcode
Getting started with Quartz Composer
Introducing the other tools
Working with the utilities

Xcode 4 is bundled with an exceptional collection of tools and utilities. These extras are easy to miss. They're not built into the main Xcode application, and many are sparsely documented. This is unfortunate, because the tools offer developers significant extra creative possibilities, finer control over app development and packaging, and advanced testing and customization features.

A full user guide for every tool would double the size of this book, so this appendix summarizes the key features of each tool. Interested readers can find more detailed information in Apple's official documentation and in online discussions.

mac_note.eps NOTE

The online URL for the tools and utilities is currently http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/OSX_Technology_Overview/Tools/Tools.html.

Finding the Tools and Utilities

Figure A.1 shows how the tools and utilities appear in /Developer/Applications. Some of the tools—Dashcode, Quartz Composer, and Instruments—are placed at the same level as Xcode in the /Applications folder to draw attention to them. The remaining tools are grouped into folders.

Figure A.1

Finding Xcode's external tools and utilities

9781118007594-fgb101.eps

Understanding the Top-Level Tools

The Instruments tool is described in detail in Chapter 16. The remaining two tools are Dashcode, a widget editor used to create mini-apps for the OS X Dashboard, and Quartz Composer.

Introducing Dashcode

Dashcode, shown in Figure A.2, supports Apple's Dashboard technology. Dashboard was introduced in OS X 10.4 Tiger, adding an alternate desktop that can be populated with small, simple applications known as widgets. Widgets are written in a combination of HTML, CSS, and JavaScript, using Apple's WebKit framework.

Dashcode was released with OS X 10.5 Leopard and is a widget design and coding tool. Apple worked hard to support widget technology by promoting its own widgets and creating a sales and promotion page for third-party developers. For a year or so, some developers made significant sums from widget sales.

Figure A.2

Dashcode's design and layout tools and the code editor have obvious similarities to Xcode.

9781118007594-fgb102.tif

But technically, widget technology is hampered by the ease with which anyone with a copy of Dashcode can open a widget and extract the graphics and source code. Apple's focus soon switched to the iPhone and iOS apps.

With the arrival of OS X Apps in OS X 10.7 Lion, widgets have become a legacy technology. Although app and widget technology doesn't overlap perfectly—widgets are designed to be small and self-contained, while OS X Apps are designed to run full-screen—the market for widget sales has almost disappeared. New developers are being encouraged toward app development for OS X.

mac_note.eps NOTE

For practical information about widget editing and creation with Dashcode, see the Cocoa Developer Reference companion title to this book.

Getting started with Quartz Composer

Quartz Composer, shown in Figure A.3, is a sophisticated tool that can create static image filters and complex animations, including screen savers. As the name suggests, it uses the Quartz image generation and processing libraries built into OS X, but you don't need to know anything about Quartz to use Composer successfully.

Figure A.3

A simple Quartz Composer project can create sophisticated animated effects.

9781118007594-fgb103.tif

Composer is the video- and image-filtering equivalent of a music synthesizer. Developers link together compositions from a library of objects—known as patches—that create and transform graphics, video, and supporting parameter information.

A composition is a set of objects with defined connections. The connections are made visually with virtual patch cords that link patch input and output parameters, which appear as terminals on each visible object. To make a connection, drag a cord from an output terminal on one object to an input terminal on another.

The library is feature-rich, with hundreds of patches. Some patches perform simple operations such as basic arithmetic or simple time-varying control of animation parameters. Others work at an intermediate level. For example, the audio splitter patch splits an audio stream into a set of frequency-filtered bins that can be used to build an audio visualizer. A few create very complex effects that you can drop into your own compositions.

The patching system includes a macro feature that can hide the internal complexity of a composition and make it reusable as a new patch called a clip. Clips can be nested almost indefinitely.

Quartz Composer includes a selection of application templates, listed in Table A.1. Most templates include sample compositions that you can modify and extend.

/Table A.1

mac_caution.eps CAUTION

Compositions saved to either /Library/Screen Savers or /Library/Compositions become available to other applications. You may need to modify file permissions before you can save files to these folders from within Quartz Composer. Also note that the link between iTunes and a Quartz Composer visualizer patch starts to work properly only after you select one of the existing visualizers in iTunes. If you don't select an existing visualizer and run it in iTunes, the visualizer template appears to do nothing.

Using Quartz Composer with Xcode

Under the hood, Quartz Composer creates Quartz library calls, which in turn are compiled to OpenGL instructions that run on a Mac's graphics card. Composer is much easier to work with than either Quartz or OpenGL. As a visual development tool with instant feedback, it's more productive and creative than the others.

You can develop for Quartz Composer visually, or you can access a code level which is closely associated with two Quartz Composer player objects: QCView and QCRenderer. On the Mac, Xcode includes a Quartz Composer plug-in application template. You can use this to create your own patches. You can also add a selection of Quartz Composer objects to your own applications from the library in IB, as shown in Figure A.4. The list includes a patch controller that can connect parameters in a composition to custom code, a player view, a parameter view, and a composition picker.

Figure A.4

Use IB to add a QCView object to the standard Mac application template.

9781118007594-fgb104.tif

Quartz Composer is very powerful and can create complex and rich video effects with little effort. Unfortunately, it remains poorly documented, and support for the API and the visual editor is minimal. However, if you have an interest in visual effects, it can be worth persevering with the documentation, which is currently at developer.apple.com/graphicsimaging/quartzcomposer. Searching for third-party examples elsewhere online is also worth the effort. There aren't many, but the ones that exist can help fill in some of the background detail missing in the official documentation.

mac_note.eps NOTE

Currently, Quartz Composer is available only on OS X. It's not supported on iOS.

Working with the Other Tools

The remaining tools are a grab bag of utilities and extras. None is essential. Some can be very useful, but others seem to be lingering for historical reasons.

Introducing the audio tools

The /Developer/Applications/Audio folder includes two tools: HALLab and AULab. HALLab (Hardware Abstraction Layer Lab), shown in Figure A.5, displays information about audio hardware and drivers. You can use it to test audio drivers and report on the status of the default system drivers.

AULab (Audio Unit Lab) is a host application for audio units. If you don't own a separate sequencer application such as Logic, you can use AULab to host and test AU plug-ins.

Figure A.5

The HALLab interface is minimal, but you can use it to check the operation of audio drivers and their related hardware.

9781118007594-fgb105.eps

Introducing the graphics tools

The graphics tools include three groups of applications: Quartz and Quartz Composer support, OpenGL support, and general graphics.

General graphics tools

There are two general graphics tools. Pixie is a floating magnifying window. Anything under the window is magnified by a factor between 1X and 12X, depending on Pixie's settings. You can lock movement horizontally or vertically. Pixie is useful for general magnification of app windows and includes a capture feature that can save the magnified image to disk.

Core Image Fun House, shown in Figure A.6, is a filter preview tool. You can test the effects of the standard Core Image filters on a small selection of images. You can also stack filters to create combined effects and use this tool to test custom filters.

Figure A.6

The results of using a couple of Core Image filters on the standard wolf image

9781118007594-fgb106.eps

Quartz graphics tools

The two Quartz graphics tools are Quartz Composer Visualizer and Quartz Debug.

Quartz Visualizer is a more sophisticated version of the Viewer tool built into Quartz Composer, with improved network support. You can use it to test local compositions and run them remotely.

Quartz Debug is a reporting and control tool that monitors frame rates and CPU loads. You can use it to enable or disable a minimal selection of hardware acceleration options.

OpenGL graphics tools

The OpenGL Driver Monitor, shown in Figure A.7, displays a fanatically comprehensive list of information about OpenGL events. To use it, click the Parameters button at the lower right of the window and select one or more driver parameters from the slide-out list. The results report the status of the OpenGL subsystem as a whole.

Figure A.7

Track system-wide OpenGL events and parameters with the OpenGL Driver Monitor.

9781118007594-fgb107.eps

The OpenGL Profiler tool is the app-specific equivalent. You can attach it to any application and use it to monitor a selection of graphics-related information. Initial set-up can be slightly tricky, and you may need to log out of your Mac and login again before this tool works correctly.

The OpenGL Shader Builder is a development and test environment for custom shader code. It provides a generic run-time environment for shader testing, with a simple editor for development. Although you can develop shader code directly in Xcode, OpenGL Shader Builder includes a selection of simple test shapes with basic but useful texture loading and selection.

Introducing the performance tools

There are two performance tools. The Quartz Debug tool is a direct alias for the Quartz Debug tool in the /Graphics Tools folder.

Spin Control reports hang events that display the Spinning Beachball of Death. To use Spin Control, launch it and leave it running. Check it when an application hangs. Spin Control can give you hints about what the application was doing at the time.

Working with the Utilities

The utilities are grouped together in /Developer/Applications/Utilities. The collection is a grab bag of assorted mini-applications. It's well worth your time to become familiar with the full list, because a few of the utilities fill in features that are missing elsewhere in OS X. Rather than listing the utilities alphabetically, the sections below collect them into related groups.

Device and hardware support utilities

With the utilities in this group, you can probe and test the I/O and hardware features of your Mac:

bl.eps The Bluetooth Diagnostics Utility counts dropped packets and checks for other Bluetooth issues. Less usefully, it also prepares a diagnostics report and uploads it to Apple's Bluetooth engineering team.

bl.eps Bluetooth Explorer lists active devices and logs discovery attempts. Devices can be interrogated to reveal a detailed set of low-level Bluetooth parameters; tested to show connection quality.

bl.eps The Packet Logger shows raw byte-level Bluetooth packet data. All three Bluetooth utilities are in the /Applications/Utilities/Bluetooth folder.

bl.eps IORegistryExplorer lists detailed information about a Mac's hardware registry, which can be useful when working with the I/O Kit OS X framework.

bl.eps iSync Plug-in maker is a tool for building and testing plug-ins that handle specific features in a hardware device, typically a cell phone. For more information, search for the iSync Plug-in Maker User Guide in the documentation.

bl.eps USB Prober monitors the USB subsystem. You can list the USB parameters and settings of each USB port and device, find the associated kernel extensions, review the USB devices listed in the IORegistry, and monitor USB events with a logger.

Application and OS support utilities

These utilities provide extra support for debugging, resource creation, and application management:

bl.eps Application Loader is used to upload apps to the App Store. You define sales information for an app in iTunes Connect and then run Application Loader to locate and copy the app to the store's review queue.

bl.eps CrashReporterPrefs, shown in Figure A.8, can create detailed crash reports for both user and system processes. This isn't helpful if you're debugging in Xcode, but it can be useful if you're testing an application in a live environment.

bl.eps FileMerge can compare—‘diff'—and merge the contents of files or directories. The file merge is ASCII-only, and the tool doesn't understand application-specific file formats. Anyone migrating from Windows can use this tool to recreate the directory-merge behavior, which is the default in Windows Explorer but isn't implemented in Finder.

bl.eps Help Indexer creates an index for a help file. For more information about supporting your application with help files, search for the Apple Help Programming Guide in the documentation.

bl.eps Icon Composer is a tool for creating and editing OS X icon files. The feature set is very basic, but it includes preview options that aren't available in standard image editors.

bl.eps Package Maker is a key utility that wraps an installer around any OS X application. You can add binaries and other elements to the installer package, specify an organization name, and customize the interface.

bl.eps SleepX schedules sleep and hibernate cycles. This can be useful for testing, but you also can use this app to wake up your Mac automatically at certain times.

bl.eps Syncrospector is a debugger and monitoring tool for the OS X synchronization engine. You can view a history of sync sessions and check the sync database. For more details, search the documentation for the Sync Services Tutorial. Alternative third-party examples are available online.

Figure A.8

Setting the Crash Reporter Preferences with CrashReporterPref is easy; this isn't a sophisticated application.

9781118007594-fgb108.eps

Language support utilities

Some utilities are designed to work with other languages. Previous versions of Xcode included templates for Java and Python applications. Apple no longer supplies these templates, but you can still use the Build Applet utility to convert Python code into stand-alone applications. Two versions are included: one for MacPython and one for the standard version of Python.

MacPython includes OS X features and supports the optional PyObjC package, which gives full access to the Cocoa libraries from Python. Standard Python is the default OS-independent version of Python.

mac_note.eps NOTE

Early beta versions of Xcode 4 included corresponding tools for creating Java applications from Java code. Apple is scaling down its Java support, and these tools weren't included in the final release.

Accessibility utilities

The accessibility utilities test an application's support for accessibility features. The two main utilities are in the /Applications/Utilities/Accessibility Tools folder. The speech synthesizer editors are in /Applications/Utilities/Speech.

bl.eps Accessibility Inspector reports accessibility attributes and actions when you roll the mouse cursor over the controls in an application's UI.

bl.eps Accessibility Verifier checks for mistakes in an application's accessibility information.

bl.eps Repeat After Me can improve the performance and legibility of the standard OS X speech synthesizer. This application includes a PDF manual.

bl.eps SRLanguageModeler supports custom language model design for the speech synthesizer.

Introducing the Command-Line Tools

Most of the features of Xcode are duplicated at the command-line level. If you prefer to work with pipes, processes, and raw text, you can use all the tools that are standard in any BSD (Berkley Software Distribution) UNIX distribution. Xcode adds a selection of other tools that are specific to OS X development. The tools can compare and process text files; automate events under the control of Python, Perl, Ruby, or Java code; and provide low-level information about memory use and the Mac's hardware.

The complete list of tools is very long. Many are highly specialized, and some are obsolete. Because most of the useful features are also available in Xcode, a full description is outside the scope of this book. However, hardware developers should review the list in Apple's Tools documentation (available at the URL listed earlier in this appendix) because some of the kernel and I/O level tools can only be accessed from the command line.

mac_note.eps NOTE

Unlike the other tools and utilities mentioned in this appendix, the Command-Line Tools aren't installed by default. To install them, check the “UNIX Development” box when you install Xcode.

Summary

This appendix listed the tools and utilities that are bundled with Xcode but aren't built into the main application. It explored Dashcode and Quartz Composer and listed the audio, graphics, and performance monitoring tools. Finally, it introduced the full set of supporting utilities and briefly summarized each one.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.214.215