Beginning Xcode Programmer To Programmer 1st Edition James Bucanek Download
Beginning Xcode Programmer To Programmer 1st Edition James Bucanek Download
https://ebookbell.com/product/beginning-xcode-programmer-to-
programmer-1st-edition-james-bucanek-2531120
https://ebookbell.com/product/beginning-xcode-swift-3-edition-1st-ed-
matthew-knott-55239798
https://ebookbell.com/product/beginning-xcode-swift-edition-2nd-
edition-matthew-knott-55604466
https://ebookbell.com/product/beginning-xcode-1st-edition-matthew-
knott-auth-4661604
https://ebookbell.com/product/beginning-xcode-swift-3-edition-knott-
matthew-11862804
Beginning Xcode Matthew Knott
https://ebookbell.com/product/beginning-xcode-matthew-knott-5412104
https://ebookbell.com/product/beginning-ios-storyboarding-with-xcode-
new-ed-lewis-rorymccarthy-20009608
Beginning Devops On Aws For Ios Development Xcode Jenkins And Fastlane
Integration On The Cloud Abdullahi Olaoye
https://ebookbell.com/product/beginning-devops-on-aws-for-ios-
development-xcode-jenkins-and-fastlane-integration-on-the-cloud-
abdullahi-olaoye-38329344
Beginning Ios 13 Swift App Development Develop Ios Apps With Xcode 11
Swift 5 Core Ml Arkit And More Lim
https://ebookbell.com/product/beginning-ios-13-swift-app-development-
develop-ios-apps-with-xcode-11-swift-5-core-ml-arkit-and-more-
lim-10897604
Beginning Ios Programming With Swift And Swiftui Ios 18 And Xcode 16
Simon Ng
https://ebookbell.com/product/beginning-ios-programming-with-swift-
and-swiftui-ios-18-and-xcode-16-simon-ng-230820558
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
. .Beginning Xcode
byJames Bucanek
Wrox Press 2006 (620 pages)
ISBN:047175479X
Featuring step-by-step instructions that can be applied directly to your projects, this book covers the basic
fundamentals of Xcode development and shows you how it can help you achieve a seamless, comfortable,
and productive working environment.
Table of Contents
Beginning Xcode
Introduction
Chapter 1 - Installing Xcode
Chapter 2 - The Grand Tour
Chapter 3 - Xcode Layout
Chapter 4 - The Project
Chapter 5 - Sources
Chapter 6 - Editing Text
Chapter 7 - Searching
Chapter 8 - Class Browser
Chapter 9 - Help and Documentation
Chapter 10 - Interface Builder
Chapter 11 - Class Modeling
Chapter 12 - Data Modeling
Chapter 13 - Targets
Chapter 14 - Building Projects
Chapter 15 - Debugging
Chapter 16 - Performance Analysis
Chapter 17 - Unit Testing
Chapter 18 - Sharing Source
Chapter 19 - Customizing Xcode
Appendix A - Exercise Answers
Appendix B - Project Templates
Index
List of Listings
List of Sidebars
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
Back Cover
Xcode is a powerful suite of free development tools from Apple Computer that will allow you to create Macintosh
applications, plug-ins, web components, applets, and more using languages such as C, C++, Objective-C, Java, and
AppleScript.
How to access a source control management system, right in the Xcode interface.
How to quickly navigate to files, symbols, bookmarks, declarations, and definitions within your project; find
reference documents and instantly access API documentation.
Harness Xcode’s smart editing features, such as auto-indent, code completion, and text macros.
Discover how easy it is to browse class information and create dynamic class diagrams.
Get started using Xcode’s Interface Builder and Data Modeling design tools.
Learn to customize target build phases, add your own compilers, write your own build processes, and
integrate Xcode with other build tools like Ant and gnumake.
Harness the full power of the debugger with smart breakpoints and custom data formatters. Learn how to
change variables, and even fix bugs, while your program is still running.
Start using Xcode’s suite of performance analysis tools to find problems and accelerate your code.
Customize scores of hidden, and often undocumented, Xcode features. Learn how to remap keyboard
commands, create your own project and file templates, and even add your own commands to the Xcode
menus.
Instead of "cookbook" projects specific to a particular language, developer James Bucanek details each Xcode feature with
step-by-step instructions that can be applied directly to your projects. Example projects that demonstrate a single concept
make it easy to explore each feature.
James Bucanek has spent over 25 years programming and developing microprocessor systems. He has experience with a
broad range of computer hardware and software, from the smallest embedded consumer products to robotic control of
silicon wafer deposition furnaces used in integrated circuit manufacturing. His development projects include the first local
area network for the Apple ][, distributed air conditioning control systems, a piano teaching system, digital oscilloscopes, and
collaborative writing and assessment tools for K-12 education. James holds a Java Developer Certification from Sun
Microsystems and was awarded a patent for optimizing local area networks. He has been the technical editor and a
contributing author for several recent books on Mac OS X. James is currently focused on Macintosh software development,
where he can combine his deep knowledge of UNIX and object-oriented languages with his passion for elegant design.
James holds an Associates degree in classical ballet from the Royal Academy of Dance.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
Beginning Xcode
James Bucanek
WILEY
Wiley Publishing, Inc.
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
http://www.wiley.com
Indianapolis, Indiana
ISBN-13: 978-0-471-75479-4
0-471-75479-X
10 9 8 7 6 5 4 3 2 1
1B/RW/QT/QW/IN
1. Mac OS. 2. Operating systems (Computers) 3. Computer software—Development. I. Title. QA76.76.O63B826 2006
005.4 ′46—dc22
2005037953
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or
108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or
authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood
Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be
addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317)
572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions.
For general information on our other products and services please contact our Customer Care Department within the
United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are
trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other
countries, and may not be used without written permission. Xcode is a registered trademark of Apple Computer, Inc. in
the U.S. and other countries. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is
not associated with any product or vendor mentioned in this book.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be
available in electronic books.
Credits
Acquisitions Editor
Katie Mohr
Development Editor
Adaobi Obi Tulton
Technical Editor
Michael D. Trent
Production Editor
Michael Koch
Copy Editor
Kathryn Duggan
Editorial Manager
Mary Beth Wakefield
Production Manager
Tim Tate
Project Coordinator
Ryan Stefffen
Lauren Goddard
Denny Hager
Jennifer Heleine
Barbara Moore
Alicia B. South
This book is dedicated to Deborah and Doug for two decades of friendship and support.
James Bucanek has spent over 25 years programming and developing microprocessor systems. He has experience
with a broad range of computer hardware and software, from the smallest embedded consumer products to robotic
control of silicon wafer deposition furnaces used in integrated circuit manufacturing. His development projects include
the first local area network for the Apple ][, distributed air conditioning control systems, a piano teaching system, digital
oscilloscopes, and collaborative writing and assessment tools for K-12 education. James holds a Java Developer
Certification from Sun Microsystems and was awarded a patent for optimizing local area networks. He has been the
technical editor and a contributing author for several recent books on Mac OS X. James is currently focused on
Macintosh software development, where he can combine his deep knowledge of UNIX and object-oriented languages
with his passion for elegant design. James holds an Associates degree in classical ballet from the Royal Academy of
Dance.
Acknowledgments
This book wouldn't have been possible without the patience, experience, and guidance of my editor, Adaobi Obi
Tulton. Ms. Tulton spent countless hours reviewing the manuscript, correcting my grammar, suggesting changes to
make it more readable, keeping me on schedule, and handled the countless administrative and technical details
required to publish a technical book. If my knowledge of Xcode is communicated to you, it is Adaobi's knowledge of
publishing that made it possible.
Standing just behind Adaobi Tulton is the fantastic staff of Wiley publishing. From the acquisition editor to the
production staff, every individual I've worked with has been friendly, professional, and stunningly easy to work with. I
would also like to thank my agent, Laura Lewin, and the other talented individuals at StudioB, for all of their help.
Having been a technical editor myself, I am uniquely qualified to appreciate the contribution of Michael Trent, the
technical editor on this book. Michael painstakingly reviewed each detail and procedure, making sure everything
presented was correct, consistent, and unbiased. Michael, who is also an accomplished book author and professional
developer, made many suggestions; often pointed out features, shortcuts, and practices that I was unaware of.
Michael substantially influenced the breadth and richness of this book. I take full responsibility for any inaccuracies
herein, but Michael is largely responsible for its precision.
I would also like to acknowledge Kirk McElhearn and Dan Frakes. Kirk is a prolific and entertaining author of many fine
books on the Macintosh, iPod and other topics. Dan has written the Mac OS X Power Tools book and is senior writer
for MacWorld and PlayList magazines. Kirk is the one who recommended me when Wiley publishing was searching for
an author for this book. I've work with both Kirk and Dan on several writing projects in the past. If one learns by
example, these two gentlemen have been my greatest teachers.
Finally, this book would not even exist if it weren't for the imagination, skill, and hard work of the Xcode development
team. I would particularly like to thank Chris Espinosa, Eric Albert, Jim Ingham, and Scott Tooker at Apple for
answering my numerous technical questions about Xcode over the past six months. A very special thank you goes to
Chris Hanson, who spent a considerable amount of time patiently explaining the inner workings of Xcode's unit test
framework.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
Introduction
Overview
Welcome to Xcode. Xcode is Apple Computer's integrated development environment (IDE) used for writing, building,
and testing programs to run on the Mac OS X operating system. Using Xcode, you can create a wide variety of
applications, plug-ins, drivers, and frameworks using different technologies and languages. It includes tools to design,
edit, analyze, debug, test, package, and distribute your projects. It can be used by an individual developer or to
collaborate with a group of developers.
An IDE is the "glue" that gathers together and helps you manage all of the little pieces that are needed to produce
modern software. It is entirely possible to edit, compile, link, bundle, and test your software without using an IDE. In
fact, that was how software used to be developed—and still is, occasionally. You can edit your files with an editor,
save them, run a compiler to compile the source, run a linker to link the object files into a program, and then start a
debugger to test it. Most of these tools have little or no user interface, being driven almost exclusively from the
command line. As applications become more complex, however, so do the tools needed to produce them. Even a
"simple" project might employ a dozen different tools to create a working application. Using the correct tools, running
them in the correct order with the correct arguments, managing the hundreds of intermediate files produced during this
process, and doing this repeatedly and consistently becomes a huge burden on the developer—sucking most of the
joy and spontaneity out of your life.
Enter the IDE. The Xcode IDE puts a convenient, friendly, and graphical face on all of the tools you need to develop
your project. Instead of dealing with individual folders and files, Xcode presents you with a project window filled with
icons representing its constituent parts. Instead of maintaining macros and compiler rules, Xcode gives you a list of
build settings. Instead of wrestling with the complex syntax of debugger commands, Xcode highlights the line in the
source that your application is executing and shows you the state of its variables, conveniently formatted in a
scrollable table. By simply dragging icons, you can make complex structural changes to your projects.
Despite its complexity, and the length of this book, it's interesting to consider that Xcode doesn't really "do" much of
the actual work in producing your finished product. It doesn't compile your source code, it doesn't build your NIB files, it
doesn't link your code, it doesn't assemble your application bundle, and it doesn't control your code during debugging.
What Xcode does is bring together all of the tools that actually do this work and make them appear to be a single
application. It's a facilitator that smoothes out the wrinkles between all of the parts, leaving you with a seamless,
comfortable, and productive working environment.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
For a few development targets, however, Xcode may be a less-than-optimal choice. Java programmers who want to
develop "pure" cross-platform Java applications have several IDE choices beyond Xcode. Although Xcode is certainly
capable of producing any kind of Java application, Java IDEs like Eclipse (http://www.eclipse.org/) offer many more
Java-specific features. If your goal is to download and build, but not really develop, open source projects, then Xcode
can be somewhat superfluous. Most open source projects have self-contained make files that will build the project for
you. While it's possible to integrate these projects into Xcode, you may find very little advantage in doing so unless you
plan to extensively explore or alter those projects.
Having said that, Xcode is unmistakably the most comprehensive development environment available for Mac OS X.
Although it might not be the perfect choice for every kind of development project, there are very few kinds of programs
that it can't produce. If you only want to learn one development tool for Mac OS X, Xcode is it.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
The Xcode Developer Tools package includes a huge collection of tools, including Xcode itself. Some of these tools
are integrated with the Xcode application and some are not. Tools that are not integrated are not covered here, and
the ones that are integrated are only discussed in terms of how those tools are used from within Xcode. For example,
the entire debugging interface is thoroughly discussed in Chapter 15. Everything you will do while debugging, from
setting conditional breakpoints to editing memory, is ultimately preformed by the gdb debugger under the direction of
the Xcode application. Although the full range of capabilities provided by Xcode's debugger interface is explained, I
make no attempt to teach you how the gdb tool works or its command syntax. The same thing goes for the compilers,
linkers, and other tools employed by Xcode.
In some ways, this is the point of using Xcode in the first place: so you don't have to deal with the complex, and often
arcane, details of tools like gdb. You'll be amazed at how little you need to know about the tools that work behind the
scenes. I've been developing Macintosh applications for years, and never once have I had to run the compiler or linker
directly from the command line. And even if you do want to dig down in the details of these tools, Xcode is still the
place to start. If nothing else, Xcode will show you how these tools are nominally used and how they fit into the overall
development picture.
What this book doesn't cover is how to program. You may find it ironic that a book about software development has
very little in the way of actual code or programming advice. The code and projects used throughout this book are
minimal and written explicitly to demonstrate the features and concepts being explained. The breadth of Xcode is
partially to blame—that, and the fact that my publisher won't let me write a 4,000-page book. Xcode supports
development in C, C++, Objective-C, Java, and AppleScript, using Java, Carbon, Cocoa, and UNIX APIs, and can be
extended using bash, tcsh, perl, python, awk, and other scripting languages. An introduction to any one of these topics
is a book on its own, and you'll find many well-written books have already been published on all of these subjects. If
you want to get started developing applications for Mac OS X, consider Xcode one half of your journey. Choose your
language and programming API, and then let this book show you how to build your product using those technologies.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
While this order follows the typical edit-compile-run sequence of development, we all know that development rarely
happens in exactly that order and is never a purely linear process. Although the project you will be working on six
months from now might include three targets, your first project—from start to finish—will probably only use the one
preconfigured target that was set up automatically for you. This may predispose you to skip over the sections in
Chapter 13 that explain how to create new targets. Read enough of the chapter to understand targets and what role
they play in your project, and then move on. You can always come back to those sections when you need to create a
target yourself.
Along the way, this book introduces concepts and technologies that you may be completely uninterested in. Chapters
8, 10, 16, 18, and 17, for example, are self-contained and don't introduce any concepts that will prevent you from
understanding the other chapters in this book. That's not to say that you shouldn't at least take a quick peek. Some of
the technologies presented in these chapters are down right amazing. Try some of them out—you'll be glad you did.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
You need to know how to program. If you are just starting out, begin with an introductory programming book for the
language of your choice. If you want to develop "real" Macintosh applications, start with Objective-C and Cocoa. If you
want to learn to program in a language more applicable to other platforms, learn Java. If you are already an
accomplished C/C++ programmer and want to stick with that language, find a book on Carbon (Mac OS X's C
interface). Ideally, try to use a book that is written specifically for the Macintosh. These include programs, examples,
and even Xcode projects that you can build and run without translation. These are very general
recommendations—use your own experience and goals to guide your choice. After you are comfortable with the
language you want to develop with, return to this book to learn how Xcode can help you turn your programming ideas
into reality. Alternatively, keep this book alongside your others and learn Xcode as you go along.
Many examples in this book use entire projects to demonstrate a feature. See the "Source Code" section, later in this
introduction, for information on how to download the projects and source files used throughout this book.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks .
Conventions
To help you get the most from the text and keep track of what's happening a number of conventions are used
throughout the book.
Try It Out
The "Try It Out" sections are exercises you should work through, following the text in the book. For instance:
1. They usually consist of a set of steps.
How It Works
After each "Try It Out" section, the code you typed is explained in detail.
Additional Information
Importent Boxes like this one hold important, not-to-be forgotten information that is directly relevant to the
surrounding text.
Note Tips, hints, tricks, and asides to the current discussion are offset and placed in italics like this.
Text Styles
URLs and code within the text are in monofont, like this: persistence.properties
Source Code
As you work through the examples in this book, you may choose either to create your projects manually or to use the
projects that accompany the book. All of the projects used in this book are available for download at
http://www.wrox.com. When you are at the site, simply locate the book's title (either by using the Search box or by
using one of the title lists) and click the Download Code link on the book's detail page to obtain all the projects for the
book.
NoteBecause many books have similar titles, you may find it easiest to search by ISBN; this book's ISBN is
0-4717-5479-X (changing to 978-0-4717-5479-X as the new industry-wide 13-digit ISBN numbering system is
phased in by January 2007).
Alternately, you can go to the main Wrox code download page at http://www.wrox.com/dynamic/books/download.aspx
to see the code available for this book and all other Wrox books.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com
. to registe
Bonus Sections
Due to length constraints, a few topics didn't make it into this edition of the book. These have been collected and are
available for download at http://www.wrox.com as bonus sections. Follow the links to download the projects files, as
described previously.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
Errata
Every effort is made to ensure that there are no errors in the text or in the code. However, no one is perfect, and
mistakes do occur. If you find an error in one of our books, like a spelling mistake or faulty piece of code, we would be
very grateful for your feedback. By sending in errata, you may save another reader hours of frustration, and at the
same time, you will be helping us provide even higher quality information.
To find the errata page for this book, go to http://www.wrox.com and locate the title using the Search box or one of the
title lists. Then, on the book details page, click the Book Errata link. On this page, you can view all errata that has been
submitted for this book and posted by Wrox editors. A complete book list including links to each's book's errata is also
available at http://www.wrox.com/misc-pages/booklist.shtml.
If you don't spot "your" error on the Book Errata page, go to http://www.wrox.com/contact/techsupport.shtml and
complete the form there to send us the error you have found. We'll check the information and, if appropriate, post a
message to the book's errata page and fix the problem in subsequent editions of the book.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
http://p2p.wrox.com
For author and peer discussion, join the P2P forums at http://p2p.wrox.com. The forums are a Web-based system for
you to post messages relating to Wrox books and related technologies and interact with other readers and technology
users. The forums offer a subscription feature to e-mail you topics of interest of your choosing when new posts are
made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these
forums.
At http://p2p.wrox.com, you will find a number of different forums that will help you not only as you read this book, but
also as you develop your own applications. To join the forums, just follow these steps:
1. Go to http://p2p.wrox.com and click the Register link.
3. Complete the required information to join as well as any optional information you wish to provide
and click Submit.
4. You will receive an e-mail with information describing how to verify your account and complete the
joining process.
Note You can read messages in the forums without joining P2P, but in order to post your own messages, you must join.
After you join, you can post new messages and respond to messages other users post. You can read messages at
any time on the Web. If you would like to have new messages from a particular forum e-mailed to you, click the
Subscribe to this Forum icon by the forum name in the forum listing.
For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about
how the forum software works as well as many common questions specific to P2P and Wrox books. To read the
FAQs, click the FAQ link on any P2P page.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
Overview
Xcode is part of the Xcode Developer Tools suite developed and distributed by Apple Computer. If you haven't
installed it already, read this chapter to find out how to do so. If the tools are already installed, you can skip to the next
chapter.
Importent If you've already installed Xcode, be aware that the default installation choices do not include all
Xcode components. Features described in some chapters may require you to reinstall the omitted
packages before you can use them. Return to this chapter to reinstall, upgrade, or remove the
Xcode Developer Tools in your system.
The Xcode Development Tools encompass a huge amount of material: dozen of applications, scores of utilities,
hundreds of sample projects, and tens of thousands of pages of documentations. Despite its scope, the developer
tools team at Apple has made it remarkably easy to install this wealth of tools in only a few minutes.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
The Xcode Developer Tools installer is included on every Mac OS X 10.4 installation and upgrade DVD. So if you
have a Mac OS X 10.4 installer DVD, you should already have a copy of Xcode. However, the copy of Xcode on the
original release of OS X 10.4 is Xcode version 2.1. Although you can successfully use this book with Xcode 2.1, there
are numerous small differences between 2.1 and 2.2. Download and install Xcode 2.2 if you can.
You can download a disk image of the latest Xcode Developer Tools from the Apple Developers Connection at
http://developer.apple.com/. Anyone with an ADC account can download the latest development tools, software
development kits, and example code directly from Apple.
Online ADC accounts are free and require only that you create an ADC account and agree to the nondisclosure
agreement that covers all Apple development technologies. Student, Select, and Premier accounts can be purchased
and include many additional benefits. One of these is the monthly ADC mailing, which ships current copies of the tools
and reference material to you on CD or DVD. Other perks include discounts on hardware used for development and
direct access to Apple engineers for technical questions. If you are serious about developing software for Mac OS X,
you should invest in a Student or Select membership.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
Figure 1-1
The installer presents a simple greeting screen. Click the Continue button. It next presents the software licensing
agreement that accompanies the use of all of the developer tools provided by Apple Computer. The pop-up menu at
the top of the window allows you to read the licensing agreement in English or Japanese. Review the document using
the scroll bar. If you like, you can save it as a PDF file for review or for your records by clicking the Save button. The
Print button prints the licensing agreement on any available printer.
After you click the Continue button, a dialog box asks you to confirm that you agree to the terms of the license. Click
the Agree button.
Use the next screen, shown in Figure 1-2, to select the volume where the Xcode tools will be installed. The Xcode
Development Tools can only be installed on the volume your operating system is currently booted from. In addition, the
operating system you are running must meet the minimum requirements of the version of Xcode you are trying to
install. If these conditions are not met, the volume has a red alert badge. Select the volume to find out why the tools
can't be installed there.
Figure 1-2
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
After selecting your boot volume, click the Continue button again. In the next screen, the installer offers to perform a
basic installation or upgrade of the Xcode tools. This is suitable for most beginning developers. Remember that you
can always run the installer again to install additional packages in the future.
If you want to expand or contract the set of software tools that get installed, click the Customize button. The pane
changes to a list of packages, as shown in Figure 1-3.
Figure 1-3
Each package is listed, along with an action and the estimated amount of disk space that package will consume on the
volume. Select a package in the list for a brief description of what the package contains.
The following table explains the contents and usefulness of the various Xcode Developer Tools packages.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
Package Description
Developer Tools This package contains the core set of development tools, including the Xcode IDE. You
Software must install this package if you plan on working with Xcode.
gcc 4.0 The latest version of the gcc compiler. By default, all new projects will use gcc 4.0. You
should install this package.
gcc 3.3 The previous version of the gcc compiler. Install this package if you need to compile
programs that were written for gcc 3.3 and don't want to compile cleanly with gcc 4.0 —
for whatever reason. I recommend installing this package if you plan to build any
pre-existing software, be that Xcode projects or open source.
Software This is a group of packages that contains the headers, libraries, and development tools
Development needed to develop applications using these technologies. To write any kind of Macintosh
Kits software, you must install the Mac OS X SDK. To write any kind of command-line tool or
to use any of the standard C libraries, you will need the BSD SDK. If you have no plans
to write an X11 application or FireWire driver, you can save some disk space by omitting
the more obscure packages. If you have any doubts, install them all. You could waste a
lot of time trying to figure out why you can't use a particular set of APIs only to remember
later that you didn't install the necessary SDK.
Java Developer This group of packages includes the basic Java developer tools and documentation.
Tools Even if you don't plan to write Java applications, install the tools package anyway. They
actually take up very little space — most of the Java tools are part of the Java framework
that's included in the OS — and it's just easier to install them now than wonder why
things don't work later. The documentation, on the other hand, is a different matter. If you
plan to write Java code, install the reference documentation. The size shown for the
documentation is not accurate. The size listed is for the compressed archive of
documentation that will be expanded when installed. On my system, the Java
documentation occupies about 135MB of disk space.
Developer This is the ADC Reference library. It contains an invaluable collection of core developer
Documentation documentation, API documentation, articles, and technical nodes. You should definitely
install this package.
Automator Shell This is a set of Automator actions that let you build projects, check them in and out of
Scripts and source control, and prepare finished applications for installation. Install this package if
Actions you plan to use Automator in your development workflow.
CHUD Tools This package contains an advanced set of performance analysis and debugging tools,
including the amazing Shark application that is used extensively in Chapter 16. The
CHUD tools are often updated independently of Xcode and have their own installer. If
you plan to use these tools, check the ADC web site for a more recent version.
If you decide against selecting a custom set of packages, you can return again to the default installation choices by
clicking the Easy Install button.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
After you choose what you want to install, click the Install button to start the installation process, shown in Figure 1-4.
You will have to supply the account name and password of an administrator when asked.
Figure 1-4
The installer takes longer than what you would infer from observing the progress bar in the installer window. Most of
the documentation gets unpacked from compressed archives. This occurs at the end of the normal installation
process, so be patient. The installer may say that it has "less than a minute" remaining for ten or more minutes. Do not
panic and force the installer to quit! You'll end up with a royal mess and have to start all over again.
The bulk of the installation occurs in the /Developer folder that is created at the root level of your boot volume, shown
in Figure 1-5. Here you will find all of the Xcode applications, command-line tools, example code, and documentation.
Do not attempt to move or rename this folder. The installer places support files in the system-wide /Library/Application
Support/Apple/Developer Tools folder. It installs some special development frameworks, resources, and a few patches
into the /System folder. Finally, it installs several UNIX man pages and a handful of tools into the /usr and /bin folders.
Figure 1-5
After the installer is finished, check out the About Xcode Tools.pdf document for an overview of the Xcode
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
Developers Tool package and for any late-breaking news, additions, or corrections. The installer does not require you
to restart your system afterwards. You can now skip to Chapter 2.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks .
Upgrading Xcode
If you already have an older version of Xcode installed, you'll find some subtle differences when you run the installer
again. The installer automatically detects the version of any package that you have previously installed. A basic
installation upgrades any packages that need to be upgraded. The custom package selection, shown in Figure 1-6,
displays which packages can be upgraded, installed, or skipped. An upgrade indicates that the installer has a newer
version of the package to install. The size indicates the estimated amount of additional disk space required to upgrade
the package. Skipped packages will not be upgraded or installed. If a package is disabled, Xcode has determined that
the existing package does not need to be, or cannot be, upgraded. This is typically because you already have the
most current, or a later, version of this software installed. The Xcode installer will never "downgrade" a package by
attempting to install an older version over a newer one.
Figure 1-6
After you selected the packages you want upgraded, click the Upgrade button. The installer runs much as it does
when installing for the first time.
Typically you won't have any problems using your upgraded tools as soon as the installer is finished. However, if you
immediately start using some of the performance analysis tools or attempt distributed builds, you may run into
problems. These facilities use daemons and system frameworks that may need to be reloaded. Restart your system
after upgrading your Xcode tools.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks .
To remove your installation of Xcode, open a Terminal window and enter the following command.
sudo perl /Developer/Tools/uninstall-devtools.pl
If this file is not present, you can run the script from whatever Xcode Developer Tools install disc or image you have.
Mount the disc or image and run the script directly from there. This will be something like the following command but
possibly with a different path:
sudo perl /Volumes/Xcode\ Tools/Utilities/uninstall-devtools.pl
The script must be run from an administrator's account. The sudo command prompts you for the password to that
account.
The script uses the receipts left by previous installations of Xcode to surgically remove everything that was previously
installed. It also takes care of a few special cases, such as removing symbolic links that get created during the
post-installation process.
After the old copy of the developer tools is removed, you can reinstall whatever version of Xcode you want. The
installer treats this as a new installation, installing fresh copies of everything.
After you reinstall the tools, you must restart your system. The uninstall-devtools script stops processes like the
distributed build daemon, but the installer does not restart them again. Removing system frameworks and then
replacing them with altered versions can seriously confuse the operating system. Restarting your computer causes all
of these resources to be reloaded, reinitialized, and restarted properly.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to registe
Summary
You're probably eager to start exploring Xcode, but installing the software first is a necessary evil. As you've seen, the
process is relatively painless and quick.
Neither Xcode nor Disneyland has been intentionally designed to be cryptic or confusing. In fact, both go out of their
way to be as friendly and accommodating as possible. However, the sheer size and complexity of what they offer
cause them to be perplexing and frustrating at times. If you take a moment to get a feel for the scope and organization
of Xcode, your initial forays will be much more enjoyable. So start down Main Street — I mean, with the project
window — and get your bearings.
The Project
The central construct in Xcode, both physically and metaphorically, is the project. Everything you will accomplish in
Xcode begins with a project. A project is stored as a document on your file system. The project window, shown in
Figure 2-1, is the manifestation of that document in the user interface.
Figure 2-1
Locate the Hello project that accompanies this book. See the "Introduction" to learn how to obtain the projects
and other resources for this book. Then follow these steps:
1. Open the folder that contains the Hello project. It should look similar to the folder in Figure
2-2.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks .
Figure 2-2
If you don't have ready access to the projects for this book, follow these steps:
1. From the Xcode File menu, choose the New Project command.
2. In the Application group, choose Cocoa Document-based Application. Click the Next button.
4. Click the Choose button to pick a location for the new project.
How It Works
Each Xcode project is stored in a project document. The folder that contains that document is the project folder. The
other items in the project folder are the project's source files and folders.
Use this project to explore the various groups in the project window. You can also build, run, and even debug this
project. Explore the properties of source items, groups, and other objects by Control-/rightclicking them.
The Groups & Files pane is where everything that constitutes your project is represented and organized. This list
consists of a hierarchy of groups, which should be instantly recognizable to anyone who has used applications like
iPhoto. Click the expansion triangle to the left of a group's icon to explore its contents.
The right side of the window is a multi-purpose pane. It usually shows the details of a selection made in the Groups &
Files pane, but it can also be used as an editor — or you may not even have a right side to your window. Xcode
provides different window layouts to suite your work style. Chapter 3 explains these different styles and how to
navigate your workspace.
Source Group
Broadly, there are two kinds of groups in the Groups & Files pane. At the top is the project group. This has the same
icon and name as the project document. The project group organizes all of the sources used in the project, and is
generically referred to as the source group. Sources are the files and folders used in your project. This could consist of
program source files, headers, property lists, image files, dynamic libraries, frameworks, testing code, and even other
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
projects. None of these constituent parts are stored in the project document itself. The files you will use to build your
project exist elsewhere on your file system. The project group only contains references to those sources, not the
sources themselves. Chapter 5 explains how to create, manage, and organize source references in the project group.
Double-clicking any source item will open it in an editor, assuming the item type is one that can be edited.
Smart Groups
The remaining groups are referred to as smart groups. Unlike the project group, which you may organize however you
like, the smart groups each represent some specific kind of information about your project. These groups are
self-organizing and update automatically to reflect the state of your project.
One of the most important smart groups is the targets group. This group shows the targets defined in the project.
Each product your project produces, typically an executable program, is represented by a target. A target is organized
into build phases. Each build phase performs a specific step in the build process, such as compiling all of the source
files for a target or copying a set of files into the resource folder of an application bundle. A source is said to be a
member of a target if the target includes that source item in any of its phases. Targets can depend on other targets.
Targets are highly customizable and extensible. Chapter 13 explains the kinds of targets Xcode provides and how to
create your own. It also shows you how to organize and customize targets to meet your needs.
The Executables smart group lists the executables (programs that can be launched and run) in the project. The
executables in a project can be run or debugged from within Xcode.
Most of the remaining smart groups gather information about your project, collecting them into readily accessible
locations. The Errors and Warnings group contains the current list of error and warning messages produced by the
build process. As with many of the smart groups, this information is available in several other locations and in other
forms as well. The Find Results smart group contains the history and results of recent searches. The Project Symbols
smart group lists all of the symbols defined in your application. You can create your own smart groups that
automatically collect source files that meet a certain criteria. If you've ever used smart playlists in iTunes, then you are
already familiar with this concept.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
Menus
The menus in Xcode are grouped by function. The File menu is where you'll find basic file and project commands. Use
these commands to create new projects, files, and groups, close windows, save files, and print.
The Edit, Format, and Find menus deal primarily with the editing of source files. The View menu controls the visual
appearance and layout of window and lists. It also contains a number of file and window navigation commands. The
Project menu contains commands specific to the project and its targets.
The Build, Debug, Design, and SCM menus contain commands for building the project, debugging an executable
program, class and data model design, and source control management respectively. Each of these topics is covered
in its own chapter. The Help menu is the gateway to the ADC reference library and the programming documentation. It
also provides a few shortcuts to commonly referenced topics.
The Window menu is one means of listing, and navigating between, the currently open windows. It provides access to
a number of project windows that are oriented towards a particular activity — such as the build window or the
debugger window — and other, more utilitarian, windows.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
Editor
Xcode includes a sophisticated and flexible set of editors. The text file editor is shown in Figure 2-3. The text editor is
syntax aware and capable of automatically formatting and highlighting text appropriately for recognized programming
languages. It also has a context-sensitive, language-specific, auto-completion function. This feature presents you with
an interactive list of the programming symbols valid at that point in your source code. The extensive editing and
navigation features of the text editor are covered in Chapter 6.
Figure 2-3
There are also many other editors, notably the property editors that appear in the numerous Info windows. More
sophisticated documents, such as NIB files, have their own editor application that integrates with Xcode's environment.
You can also tap your favorite text, image, audio, or resource editor to augment, or replace, the editors provided by
Xcode.
Chapter 10 discusses the NIB file editor. Chapter 12 explains the data model editor.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks .
Data Mining
Xcode includes a several tools for exploring the content and structure of your project. These are useful for finding
something specific in your application or for understanding the structure of classes in the project.
The simplest of these tools are the various search commands. You can search a single file, or a group of files, for text
patterns ranging from a sequence of characters to complex regular expressions. These commands are thoroughly
covered in Chapter 7.
The Class Browser, shown in Figure 2-4, compiles the classes and data structures in your application into a structured
table. Chapter 8 shows you how.
Figure 2-4
Chapter 11 introduces you to the class modeler. Like the Class Browser, it constructs a picture of your project's
classes and their relationships. But unlike the Class Browser, the picture drawn by the class modeler is — well — a
picture. The class modeler produces a graph of the classes in your application (see Figure 2-5). Models can be
customized and are dynamically updated as you alter your code.
Figure 2-5
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
Getting Help
Someone once said, "It's not what you know, it's what you can find out." This sentiment is especially applicable to
programming. It is impossible to remember every function name, every parameter, and every data type in the
thousands of classes, headers, and libraries available to you. And often the question is not so much which specific
function to call as it is "Where do I begin?"
Integrated into Xcode is the bulk of the Apple Developer Connection Reference Library, shown in Figure 2-6. This
contains a vast wealth of introductory articles, examples, and programming guidance.
Figure 2-6
The Reference Library also includes a detailed, indexed, and searchable database documenting every major API in
the Mac OS X operating system, an example of which is shown in Figure 2-7. You can instantly access the symbols in
the Reference Library from within your source code or search for them interactively.
Figure 2-7
Being a productive programmer will largely depend on being able to quickly extract what you're looking for from this
mountain of detail. Chapter 9 will help you find what you need.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
Building
The ultimate goal of any project is to produce something. Building is the act of taking the source items in your project
and transforming them into a final product. Building can be roughly divided into two activities: defining how to build
each product and then controlling what gets built and when.
The "how" portion is largely defined by the targets. Each target defines the steps and sources used to construct its
product. This is explained in Chapter 13.
The "what and when" portion is explained in Chapter 14. This chapter explains how to initiate a build process and how
to select exactly what you want to build. Most of the build process is witnessed through the project build window,
shown in Figure 2-8.
Figure 2-8
Chapter 13 also explains Xcode's system of build settings and build configurations. Build settings are collections of
options that control everything from what warnings the compiler will emit to the names of your executable files. A
project contains multiple sets of build settings, forming a layered hierarchy of values. A build setting may apply to the
entire project, or only to the files of certain targets, depending on where in the hierarchy the build setting is defined.
Build configurations add another dimension (literally) to build settings. During your development, you will need to
produce different versions of your application: one for debugging, another for analysis, and a final one for distribution.
Each version requires numerous build settings to be altered. A build configuration is an alternate version of your
project's entire build settings hierarchy. You can swap hundreds of build settings in and out simply by switching
between build configurations. Using build configurations makes it easy to configure projects that produce subtle
variations of the same products, such as debug and release versions, or not-so-subtle variations. Using build
configurations, you could produce one version of an application for in-house testing, another version for use by the
sales department, and a third variation for the field server engineers; all produced by a single project and target.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
Getting It Right
After your project is built, you then have to verify that it performs the way you intended it to. If any bugs are found, you
must locate and correct them.
Xcode is integrated with several debuggers. Launching your application under the control of a debugger, shown in
Figure 2-9, enables you to step through the code in your application, view variables, and even fix bugs and data while
it's running. The debugger facilities and commands are all explained in Chapter 15.
Figure 2-9
In addition to the debugger, you can employ unit testing and a cadre of performance and program analysis tools to
help you identify, locate, and eliminate unwanted program behavior. Chapter 16 contains an introduction to the
analysis tools. Chapter 17 outlines setting up your own unit tests.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
Collaboration
You can share projects and project source with other projects and other developers. Chapter 18 shows you how to
create common pools of project resources and how to integrate your projects with a source control manager.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com
. to registe
Summary
This should give you some idea of the breadth and scope of the Xcode development environment. As you can see,
there's a lot to cover in the subsequent chapters. You're probably anxious to get started, so move on to the next
chapter to organize your workspace and learn your way around the interface.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
Overview
Now that you have a bird's eye view of how Xcode is organized, drop a few hundred feet and look at the visual layout
of Xcode. In this chapter, you'll learn how items are organized in the Xcode project window, how to reorganize them,
how to customize your window layout, and how to get and control what information about your project is displayed.
The project window, shown in Figure 3-1, represents your project and is your home base in Xcode. All of the
components that comprise your project are organized here. It is also the central means of browsing your project,
allowing you to see the products that your project produces, symbols defined in your project, bookmarks you've saved,
and other aspects. All other windows in your project are subordinate to your project window. Closing the project
window closes the project. All other windows related to the project close as well.
Figure 3-1
Editing windows edit the contents of source files, and are where you will be spending much of your time during
development.
Info windows display detailed information about an item in your project. This is where you control the fine details and
options for each item. You can usually open an Info window by choosing Get Info. The contents of an Info window vary
depending on the type of the item, or items, being inspected. Figure 3-2 shows a typical Info window.
Figure 3-2
Reference windows contain documentation, help, and dynamic information about your project. These windows are for
browsing and reference, and cannot be edited.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
A number of Xcode commands have their own windows. Building, debugging, searching, and similar functions have
windows customized for each purpose.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
Project Layout
Xcode provides different strategies for organizing your windows and panes called layout styles. Choosing a layout
style isn't a prerequisite for creating a project, because you can change the layout style again at any time. However,
you do need to have a basic understanding of the layout styles offered by Xcode, because the layout affects how the
project window is organized, and where information about its contents is displayed. It also affects Xcode's use of
separate windows for various tasks.
Choosing a Layout
Style Description
Default All of the project groups and items are in a single browser shared with a combination details
and editor pane. Source files may be editing here, or in separate windows. Build, debug, and
other tasks open in separate windows.
Condensed The project window contains only the project groups and items. All tasks, including editing, are
performed in separate windows.
All-In-One The project and most tasks are confined to a single window.
The Default layout style, shown in Figure 3-3, is the traditional Xcode windowing style. The project window contains all
of the groups and items in a single browser. The window shares a split pane with a list and editing panes on the right
side. You can view and edit source files immediately in the right pane, or you can open them in separate windows.
Build, Debug, and similar tasks also appear in their own window. This is a good choice for general development on a
moderate-sized screen.
Figure 3-3
The Condensed layout style, shown in Figure 3-4, could also have been named the
"Everything-In-A-Separate-Window" style. The project window contains only the project's group and items. The groups
are further subdivided by a tab control at the top of the window. The tab selects between the source groups, the target
groups, and all other types of groups. This chapter shows you how you can alter this organization a little later on.
Everything else you work with, or open, appears in a separate window. This is a good style for complex projects and
for developers with very large monitors.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
Figure 3-4
The descriptively named All-In-One layout style, shown in Figure 3-5, is essentially the opposite of the Condensed
style. The project, editing, and all tasks are contained in a single window. You can switch which view you are working
with using one of several tab controls. The tab control in the upper-left corner of the window switches the entire
window between the project, build, and debugger views. While in the project view, another tab control above the right
editor pane switches the upper portion of the pane between the Detail, Project Find, and SCM Results. When in the
build view, similarly located tabs switch between the build results and the runtime output. This is a good style for
developers with small monitors or those who want to avoid the clutter of having many different windows open. This can
be particularly confusing when you're working with multiple projects at the same time. This problem is explained in
more detail in the "Opening One or More Projects" section in Chapter 4.
Figure 3-5
Despite its name, the All-In-One style does not force everything into a single window. There is nothing stopping you
from opening some source files or reference documents in separate windows. And the Inspector and Info windows are
always separate, regardless of the layout style you are using.
The View Show menu provides shortcuts to commonly accessed groups. Select one of the groups from the menu
and the view and selection moves immediately to that group. Similarly, the Window Tools menu provides a quick
way to open one of the tool windows. Using the Tools menu always opens a new window, even when using the
All-In-One style.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
The layout style is global to Xcode. After you have set it, it applies to all projects that you open. You can change it only
when all Xcode windows and projects are closed.
Select the layout in the Xcode Preferences, in the General tab. Choose Xcode Preferences, and then click the
General (leftmost) icon at the top of the window (see Figure 3-6).
Figure 3-6
Get a quick feel for the various Xcode layouts by trying them out. Follow these steps:
1. Create a new project using File New Project. In the New Project assistant, select Cocoa
Application under the Applications category and click Next. Name the project Explore
Layout. Click the Choose button, select the desktop, and click Choose. Click Finish.
4. Reopen the project by selecting its name in the File Recent Projects menu.
5. Click the Editor icon in the toolbar of the project window (Default and All-In-One layouts
only).
6. Expand the Explore Layout group in the Groups & Files tree. Expand the Other Sources
group. Click the Explore Layout_Prefix.pch source file once. Click the main.m source file
once. Doubleclick the main.m source file.
How It Works
In the Default and All-In-One layouts, selecting a source file makes the contents of the file appear immediately in the
editing pane on the right side of the window (assuming the editing pane is expanded, which is why you clicked the
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
Editor icon in step 5). Double-clicking a source file always opens it in a new window.
Shift+Command+B opens the Build window and Shift+Command+F opens the Project Find window. In the Default and
Condensed layout styles, these will open in independent windows. In the All-In-One style, the main window simply
switches to either the build view or the project view with the Project Find sub-view respectively.
Leave this example project open for the remainder of this chapter. You can close the project and trash the project
folder on your desktop when you are done.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
The very first group is the project structure group. This has the same name as the project and contains all of the
source groups and assets for the project. The remaining groups are called smart groups that contain specific types of
items. Smart groups automatically change to reflect the state of the project. Figure 3-7 points out the source and smart
groups in a layout.
Figure 3-7
Compile a file that results in errors, and the list of errors will appear in the errors and warnings group. Fix the errors
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
You can expand or collapse the contents of any group by clicking the small triangle next to the group's icon. Pressing
the Option key when expanding or collapsing expands or collapses all sub-groups as well.
The most flexible group is the project structure group. Within this group, you add the source assets (program source,
image files, documentation, and so on) that will be used to build your project. All of the groups in the project structure
group are generically referred to as source groups. These can be organized into any arbitrary arrangement of
subgroups that you like. When you created a Cocoa Application project, Xcode automatically created source groups
for Classes, Other Sources, Resources, Frameworks, and Products. Within the Frameworks groups are subgroups for
Linked Frameworks and Other Frameworks.
How many source groups you create, their names, and how you organize their contents is entirely up to you. Xcode
does not impose any kind of organization or convention when it comes to the project structure group. You are free to
put a movie file in the Classes groups. You are also free to rename the Classes group to "Wonkavator." You can just
as easily move all of your assets to the top-level project structure group and delete all subgroups. This might not
actually be a bad idea for very small projects, because too many groups just get in the way.
While this section has thus far emphasized that you have carte blanche to organize the source groups however you
see fit, there is one exception. Products and the Products group are special. Products are the end result of targets
(see Chapter 13). Products are also source files that can be used to build other products. As such, a product is both
an output (of the target) and an input (source asset). You cannot delete or rename the Products groups or any of the
products contained therein. You can rename products, but you must do this by editing the target, not the product.
Smart Groups
The remaining groups in the project window are collectively referred to as smart groups. If you have used iTunes or
iPhoto lately, this concept will be immediately clear. A smart group contains items that reflect some property or
information about your project, and have a fixed or restricted structure. Files or items that meet that criterion appear in
the group automatically, and disappear as soon as they no longer qualify. Xcode defines several smart groups whose
criteria are fixed, as listed in the following table. You can also create your own smart groups.
Targets The targets defined in the project. Expand a target to reveal its build phases. See
Chapter 13.
Errors and Any errors or warnings produced by the most recent build.
Warnings
Find Results The results of the last several searches that were performed.
SCM Pending Source Control actions for this project. SeeChapter 18.
The following applies only to source groups, because you never directly alter the content of smart groups. Thus, this
section simply refers to them as groups.
You can create a new, empty, group using the File New Group command. A new group with the name New Group
is created inside the currently selected group, or in the same group as any currently selected file, as shown in Figure
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
3-8. Replace the name of the new group and press Return.
Figure 3-8
You can gather any arbitrary set of files or groups and place them inside a newly created group in a single step using
the File Group command. A new group is created, and all of the selected groups and files become members of the
new group. You have only to name the new group and press Return.
You can rename any group or file by Option-clicking on the item's icon in the project window. You can also use this
gesture to rename smart groups that you've created. As an alternative, Control-/right-click an item and choose the
Rename command from the pop-up menu.
You can move almost any arbitrary selection of groups or items around the group hierarchy simply by dragging them to
another location in the project structure group. The drop indicator tells you if are you about to drop the items alongside
the group, or inside it.
On the left of Figure 3-9, two header files are being moved inside the Headers group. On the right, the same two files
are being moved into the project's top-level group, and appear immediately following the Headers group.
Figure 3-9
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
Finally, you can delete a group in one of two ways. The first, and most obvious way, is to delete the group and its
contents. Select a group, or groups, and choose Delete from either the Edit menu or the Control-/right-click contextual
menu. This deletes both the group and the contents of the group. If the group contained file or folder references, you
get a confirmation dialog box asking you if you want to delete just the references or the actual files. See Chapter 5 to
learn about references.
You can also delete a group without deleting its contents. Select a group, or groups, and choose the Ungroup
command from the Control-/right-click contextual menu (there is no main menu command for this). Ungroup dissolves
the group and replaces it with the items it previously contained.
You are free to alter which top-level groups are visible in your project window. For instance, if you are not using source
control you may want to hide the SCM group.
Control-/right-click any top-level group and drag down to the Preferences submenu. Here you will see all of the
standard groups defined by Xcode and any Smart Groups that you've defined. Groups that are checked will be visible
in your project window. Groups that are unchecked will not. You are free to check and uncheck whatever groups you
wish.
When you're using the Condensed layout, you have three sets of groups, defined by the Files, Targets, and Other tabs
above the groups list. Each set is independent of the other, and you can add or remove groups from any tab. I find it
convenient to have the Bookmarks group in the Files tab, since most of my bookmarks are shortcuts to places in my
source code. Add, or remove, the groups that make sense to you.
In the Default and All-In-One layout styles, you can also have multiple views of your groups. In these two layout styles,
Xcode places a split-pane control just above the group list scrollbar.
Click the split pane icon, shown in Figure 3-10, to split the list into two lists. You can now alter which groups appear in
the upper and lower panes independently. To return to one list again, click the join pane icon just below the split pane
icon of the list you want to discard. Unfortunately, Xcode does not remember which groups were visible in the second
list the next time you re-split the pane. So if you spend time customizing your groups, it's best to leave the pane split,
minimizing one or the other as desired.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks
.
Figure 3-10
You can also, rather erroneously, select any top-level group and apply the Delete command as you would a source
group. This does not actually delete the group. You can't delete any of the smart groups defined by Xcode. The Delete
command merely hides the group and is equivalent to unchecking it in the Preferences submenu. Check the group in
Preferences again and it reappears.
After you set up and customize the organization, panes, and column for a project, you can save that layout as the new
default for all new projects. Here's how:
1. Customize the layout and organization of a project.
When you're using the same layout style, all new projects will have the same size, layout, and organization that your
current project has right now. To reset the layout, execute the same command but choose the Restore To Factory
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks .
Default button instead. Note that your changes only apply to new projects and when you are using the same Xcode
layout style.
You can create one kind of smart group yourself. This is limited to automatically collecting source files that match a
particular pattern. Xcode comes with two of these "simple" smart groups pre-defined: The Implementation Files group
and the NIB Files group.
Simple smart groups come in two flavors: Simple Filter smart group and Simple Regular Expression smart group. The
Filter flavor matches files based on file name "globbing" used in the shell; *.c matches all C source files. The Regular
Expression flavor matches files using regular expressions; \.[ch]p{0,2}$ matches file names ending in .c, .h, .cp, .hp,
.cpp, or .hpp. See Chapter 7 for an extensive explanation of Regular Expressions. The "Searching Lists" section of that
same chapter has a brief description of globbing patterns.
To create your own smart group, choose either Simple Filter smart group or Simple Regular Expression smart group
from the File New Smart Group menu. A new simple smart group is immediately created, and its Info window
opens, allowing you to edit it. There is no opportunity to cancel here. If you didn't want to create the smart group, you
will have to delete it (see the next section).
In the Info window, you can edit the name under which the group will appear in the project window and even provide
something more evocative than the generic "gear folder" icon.
Start From chooses where the smart group looks for files that match the pattern. Project is the default, and refers to
the top-level project structure group. You can also choose to restrict the search to a specific group within the project.
The Recursively check box causes the Smart Group to search all subgroups of the Start From group for matches.
The Using Pattern field is either the Wildcard or Regular Expression pattern that will be used to match files. If you
selected to create a Simple Filter smart group, Wildcard will be selected. If you selected to create a Simple Regular
Expression smart group, Regular Expression will be selected. You can turn a Filter group into a Regular Expression
group, and vice versa, at any time by selecting the other radio button.
The Save For menu determines if the Simple smart group you just created will appear in all projects opened on your
system, or only the current project. The All My Projects setting is convenient for Smart Groups you plan to use over
and over again, as you can elect to use in any project just by revealing it in the project's group list.
Importent Be very careful when creating simple smart groups for all projects. There is no way to individually
delete smart groups you've created. A procedure to delete all of the global smart groups is
described in the next section. But if you want to delete some and preserve others, you will need to
reconstruct them.
Also, be careful when saving a smart group for all projects that has a Start From location that is
not the top-level project structure group. There is no clear rule for determining which group will
actually be searched in other projects. Those projects might not have a group with that name, or
they once did and the group was renamed, or the group has been moved to some other part of
the group hierarchy. Any of these conditions can cause a global smart group to search the wrong
group for files. When you're creating smart groups that you intend to use in other projects, stick to
the top-level project structure group.
You can later open the Info window for any smart group and edit its definition.
NoteOne caveat about smart groups is that sometimes they aren't very smart. Although they will usually pick up files
that you add to project, they often fail to update if you rename or remove them from the project. Closing and
opening the project will refresh the list.
One unfortunate omission from the Xcode user interface is the ability to delete smart groups that you've created. Like
the predefined smart groups, an attempt to delete them only hides them in the list. Even more irksome is that the data
structures used to store smart group definitions are opaque, making it impossible to selectively delete smart groups.
This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to register it. Thanks.
What you can do is delete all of the smart groups saved in an individual project, or all of the global smart groups
available to all projects. If you have smart groups that you want to save and others that you want to delete, you will
need to write down the settings for the ones you want to save and recreate them afterwards.
To delete all of the smart groups saved in an individual project, first close the project. Select the project's file icon in the
Finder and use the Control-/right-click contextual menu to choose Show Package Contents. Inside the .xcodeproj
package, you will find a series of files beginning with your account's short user name (Xcode preserves layout and
window preferences individually for each user). The file <your_account> .pbxuser contains the smart group definitions
that you've saved in this project. Open the file in a text editor, such as TextEdit or BBEdit, and delete the line that
begins with com.apple.ide.smrt.PBXUser SmartGroupsKey. Alternatively, this could also be accomplished via the
following command line in the Terminal:
james$ cd ~/Desktop/Explore\ Layout/Explore\ Layout.xcodeproj/
james$ mv james.pbxuser james.pbxuser.bak
james$ grep -v PBXUserSmartGroupsKey james.pbxuser.bak > james.pbxuser
To delete all of the smart groups saved for all projects, first quit Xcode. Using the Property List Editor (you will find this
in the /Developer/Applications/Utilities folder), open the com.apple.Xcode.plist file in your account's
˜/Library/Preferences folder. Look for an element with the key com.apple.ide.smrt.PBXUserSmartGroupsKey.ver10, shown
in Figure 3-11.
Figure 3-11
Delete this element and save the file. The next time you launch Xcode, it will recreate the default Implementation
Files and NIB Files groups. All other user-created smart groups will be gone.
Other documents randomly have
different content
To face page 128.
Fig. 90.
The previous heat of the crags, noticed in the first volume, p. 249, is
only a part of the cause. It operates only locally, and on remains of
sudden showers. But after any number of days and nights of rain, and in
all places exposed to returning sunshine and breezes, the distribution of
the moisture tells. So soon as the rain has ceased, all water that can run
off is of course gone from the steep hill-sides; there remains only the thin
adherent film of moisture to be dried; but that film is spread over a
complex texture—all manner of crannies, and bosses, and projections,
and filaments of moss and lichen, exposing a vast extent of drying
surface to the air. And the evaporation is rapid in proportion.
§ 15. Its rapidity, however, observe, does not account for its visibility,
and this is one of the questions I cannot clearly solve, unless I were sure
of the nature of the vesicular vapor. When our breath becomes visible on
a frosty day, it is easily enough understood that the moisture which was
invisible, carried by the warm air from the lungs, becomes visible when
condensed or precipitated by the surrounding chill; but one does not see
why air passing over a moist surface quite as cold as itself should take up
one particle of water more than it can conveniently—that is to say,
invisibly—carry. Whenever you see vapor, you may not inaccurately
consider the air as having got more than it can properly hold, and
dropping some. Now it is easily understood how it should take up much
in the lungs, and let some of it fall when it is pinched by the frost
outside; but why should it overload itself there on the hills, when it is at
perfect liberty to fly away as soon as it likes, and come back for more? I
do not see my way well in this. I do not see it clearly, even through the
wet cloth. I shall leave all the embarrassment of the matter, however, to
my reader, contenting myself, as usual, with the actual fact, that the hill-
side air does behave in this covetous and unreasonable manner; and
that, in consequence, when the weather is breaking (and sometimes,
provokingly, when it is not), phantom clouds form and rise in sudden
crowds of wild and spectral imagery along all the far succession of the
hill-slopes and ravines.
Fig. 91.
§ 16. There is this distinction, however, between the clouds that form
during the rain and after it. In the worst weather, the rain-cloud keeps
rather high, and is unbroken; but when there is a disposition in the rain
to relax, every now and then a sudden company of white clouds will form
quite low down (in Chamouni or Grindelwald, and such high districts,
even down to the bottom of the valley), which will remain, perhaps, for
ten minutes, filling all the air, then disappear as suddenly as they came,
leaving the gray upper cloud and steady rain to their work. These “clouds
of relaxation,” if we may so call them, are usually flaky and horizontal,
sometimes tending to the silky cirrus, yet showing no fine forms of drift;
but when the rain has passed, and the air is getting warm, forms the true
clearing cloud, in wreaths that ascend continually with a slow circling
motion, melting as they rise. The woodcut, Fig. 91, is a rude note of it
floating more quietly from the hill of the Superga, the church (nearly as
large as St. Paul’s) appearing above, and thus showing the scale of the
wreath.
Fig. 92.
4 We might say light, as well as cold; for it wholly depends on the degree of
light in the sky how far delicate cloud is seen.
The second figure from the top in Plate 69 shows an effect of morning light
on the range of the Aiguille Bouchard (Chamouni). Every crag casts its shadow
up into apparently clear sky. The shadow is, in such cases, a bluish gray, the
color of clear sky; and the defining light is caused by the sunbeams showing
mist which otherwise would have been unperceived. The shadows are not
irregular enough in outline—the sketch was made for their color and sharpness,
not their shape,—and I cannot now put them right, so I leave them as they
were drawn at the moment.
CHAPTER IV.
THE ANGEL OF THE SEA.
§ 1. Perhaps the best and truest piece of work done in the first
volume of this book, was the account given in it of the rain-cloud; to
which I have here little, descriptively, to add. But the question before us
now is, not who has drawn the rain-cloud best, but if it were worth
drawing at all. Our English artists naturally painted it often and rightly;
but are their pictures the better for it? We have seen how mountains are
beautiful; how trees are beautiful; how sun-lighted clouds are beautiful;
but can rain be beautiful?
Yes, assuredly. I have given some reasons for this answer in the fifth
chapter of last volume; one or two, yet unnoticed, belong to the present
division of our subject.
§ 2. The climates or lands into which our globe is divided may, with
respect to their fitness for Art, be perhaps conveniently ranged under five
heads:—
3. Grape and wheat lands, namely, rocks and hills, such as are good for
the vine, associated with arable ground forming the noblest and best
ground given to man. In these districts only art of the highest kind seems
possible, the religious art of the sand-lands being here joined with that of
pleasure or sense.
We might carry out these divisions into others, but these are I think
essential, and easily remembered in a tabular form; saying “wood”
instead of “forest,” and “field” for “meadow,” we can get such a form
shortly worded:—
But this is not altogether so. The moss-lands have one great advantage
over the forest-lands, namely, sight of the sky.
And not only sight of it, but continual and beneficent help from it. What
they have to separate them from barren rock, namely, their moss and
streams, being dependent on its direct help, not on great rivers coming
from distant mountain chains, nor on vast tracts of ocean-mist coming up
at evening, but on the continual play and change of sun and cloud.
§ 7. For these are the robes of love of the Angel of the Sea. To these
that name is chiefly given, the “spreadings of the clouds,” from their
extent, their gentleness, their fulness of rain. Note how they are spoken
of in Job xxxvi. v. 29-31. “By them judgeth he the people; he giveth meat
in abundance. With clouds he covereth the light.3 He hath hidden the
light in his hands, and commanded that it should return. He speaks of it
to his friend; that it is his possession, and that he may ascend thereto.”
That, then, is the Sea Angel’s message to God’s friends; that, the
meaning of those strange golden lights and purple flushes before the
morning rain. The rain is sent to judge, and feed us; but the light is the
possession of the friends of God, and they may ascend thereto,—where
the tabernacle veil will cross and part its rays no more.
§ 8. But the Angel of the Sea has also another message,—in the “great
rain of his strength,” rain of trial, sweeping away ill-set foundations. Then
his robe is not spread softly over the whole heaven, as a veil, but sweeps
back from his shoulders, ponderous, oblique, terrible—leaving his sword-
arm free.
Nereus, the God of the Sea, who dwells in it always (Neptune being the
God who rules it from Olympus), has children by the Earth; namely,
Thaumas, the father of Iris; that is, the “wonderful” or miracle-working
angel of the sea; Phorcys, the malignant angel of it (you will find him
degraded through many forms, at last, in the story of Sindbad, into the
Old Man of the Sea); Ceto, the deep places of the sea, meaning its bays
among rocks, therefore called by Hesiod “Fair-cheeked” Ceto; and
Eurybia, the tidal force or sway of the sea, of whom more hereafter.
§ 10. Phorcys and Ceto, the malignant angel of the sea, and the spirit
of its deep rocky places, have children, namely, first, Graiæ, the soft rain-
clouds. The Greeks had a greater dislike of storm than we have, and
therefore whatever violence is in the action of rain, they represented by
harsher types than we should—types given in one group by Aristophanes
(speaking in mockery of the poets): “This was the reason, then, that they
made so much talk about the fierce rushing of the moist clouds, coiled in
glittering; and the locks of the hundred-headed Typhon; and the blowing
storms; and the bent-clawed birds drifted on the breeze, fresh, and
aërial.” Note the expression “bent-clawed birds.” It illustrates two
characters of these clouds; partly their coiling form; but more directly the
way they tear down the earth from the hill-sides; especially those twisted
storm-clouds which in violent action become the waterspout. These
always strike at a narrow point, often opening the earth on a hill-side into
a trench as a great pickaxe would (whence the Graiæ are said to have
only one beak between them). Nevertheless, the rain-cloud was, on the
whole, looked upon by the Greeks as beneficent, so that it is boasted of
in the Œdipus Coloneus for its perpetual feeding of the springs of
Cephisus,4 and elsewhere often; and the opening song of the rain-clouds
in Aristophanes is entirely beautiful:—
“O eternal Clouds! let us raise into open sight our dewy existence, from
the deep-sounding Sea, our Father, up to the crests of the wooded hills,
whence we look down over the sacred land, nourishing its fruits, and over
the rippling of the divine rivers, and over the low murmuring bays of the
deep.” I cannot satisfy myself about the meaning of the names of the
Graiæ—Pephredo and Enuo—but the epithets which Hesiod gives them
are interesting: “Pephredo, the well-robed; Enuo, the crocus-robed;”
probably, it seems to me, from their beautiful colors in morning.
§ 11. Next to the Graiæ, Phorcys and Ceto begat the Gorgons, which
are the true storm-clouds. The Graiæ have only one beak or tooth, but all
the Gorgons have tusks like boars; brazen hands (brass being the word
used for the metal of which the Greeks made their spears), and golden
wings.
Perseus was the son of Jupiter by Danaë, who being shut in a brazen
tower, Jupiter came to her in a shower of gold: the brazen tower being, I
think, only another expression for the cumulus or Medusa cloud; and the
golden rain for the rays of the sun striking it; but we have not only this
rain of Danaë’s to remember in connection with the Gorgon, but that also
of the sieves of the Danaïdes, said to represent the provision of Argos
with water by their father Danaüs, who dug wells about the Acropolis;
nor only wells, but opened, I doubt not, channels of irrigation for the
fields, because the Danaïdes are said to have brought the mysteries of
Ceres from Egypt. And though I cannot trace the root of the names
Danaüs and Danaë, there is assuredly some farther link of connection in
the deaths of the lovers of the Danaïdes, whom they slew, as Perseus
Medusa. And again note, that when the father of Danaë, Acrisius, is
detained in Seriphos by storms, a disk thrown by Perseus is carried by
the wind against his head, and kills him; and lastly, when Perseus cuts off
the head of Medusa, from her blood springs Chrysaor, “wielder of the
golden sword,” the Angel of the Lightning, and Pegasus, the Angel of the
“Wild Fountains,” that is to say, the fastest flying or lower rain-cloud;
winged, but racing as upon the earth.
§ 13. I say, “wild” fountains; because the kind of fountain from which
Pegasus is named is especially the “fountain of the great deep” of
Genesis; sudden and furious, (cataracts of heaven, not windows, in the
Septuagint);—the mountain torrent caused by thunderous storm, or as
our “fountain”—a Geyser-like leaping forth of water. Therefore, it is the
deep and full source of streams, and so used typically of the source of
evils, or of passions; whereas the word “spring” with the Greeks is like
our “well-head”—a gentle issuing forth of water continually. But, because
both the lightning-fire and the gushing forth, as of a fountain, are the
signs of the poet’s true power, together with perpetuity, it is Pegasus who
strikes the earth with his foot, on Helicon,5 and causes Hippocrene to
spring forth—“the horse’s well-head.” It is perpetual; but has,
nevertheless, the Pegasean storm-power.
§ 14. Wherein we may find, I think, sufficient cause for putting honor
upon the rain-cloud. Few of us, perhaps, have thought, in watching its
career across our own mossy hills, or listening to the murmur of the
springs amidst the mountain quietness, that the chief masters of the
human imagination owed, and confessed that they owed, the force of
their noblest thoughts, not to the flowers of the valley, nor the majesty of
the hill, but to the flying cloud.
Yet they never saw it fly, as we may in our own England. So far, at
least, as I know the clouds of the south, they are often more terrible than
ours, but the English Pegasus is swifter. On the Yorkshire and Derbyshire
hills, when the rain-cloud is low and much broken, and the steady west-
wind fills all space with its strength,6 the sun-gleams fly like golden
vultures: they are flashes rather than shinings; the dark spaces and the
dazzling race and skim along the acclivities, and dart and dip from crag to
dell, swallow-like;—no Graiæ these,—gray and withered: Grey Hounds
rather, following the Cerinthian stag with the golden antlers.
§ 16. Another circumstance which the reader should note in this cloud
of Turner’s, is the witch-like look of drifted or erected locks of hair at its
left side. We have just read the words of the old Greek poet: “Locks of
the hundred-headed Typhon;” and must remember that Turner’s account
of this picture, in the Academy catalogue, was “Slaver throwing
overboard the Dead and Dying. Typhoon coming on.” The resemblance to
wildly drifted hair is stronger in the picture than in the engraving; the
gray and purple tints of torn cloud being relieved against golden sky
beyond.
72. The Locks of Typhon.
But the likeness to serpents we may illustrate here. The two Plates
already given, 70 and 71 (at page 127), represent successive conditions
of the Medusa cloud on one of the Cenis hills (the great limestone
precipice above St. Michel, between Lanslebourg and St. Jean di
Maurienne).9 In the first, the cloud is approaching, with the lee-side cloud
forming beyond it; in the second, it has approached, increased, and
broken, the Medusa serpents writhing about the central peak, the
rounded tops of the broken cumulus showing above. In this instance,
they take nearly the forms of flame; but when the storm is more violent,
they are torn into fragments, and magnificent revolving wheels of vapor
are formed, broken, and tossed into the air, as the grass is tossed in the
hay-field from the toothed wheels of the mowing-machine; perhaps, in
common with all other inventions of the kind, likely to bring more evil
upon men than ever the Medusa cloud did, and turn them more
effectually into stone.10
§ 18. I have named in the first volume the principal works of Turner
representing these clouds; and until I am able to draw them better, it is
useless to say more of them; but in connection with the subject we have
been examining, I should be glad if the reader could turn to the
engravings of the England drawings of Salisbury and Stonehenge. What
opportunities Turner had of acquainting himself with classical literature,
and how he used them, we shall see presently. In the meantime, let me
simply assure the reader that, in various byways, he had gained a
knowledge of most of the great Greek traditions, and that he felt them
more than he knew them; his mind being affected, up to a certain point,
precisely as an ancient painter’s would have been, by external
phenomena of nature. To him, as to the Greek, the storm-clouds seemed
messengers of fate. He feared them, while he reverenced; nor does he
ever introduce them without some hidden purpose, bearing upon the
expression of the scene he is painting.
§ 19. On that plain of Salisbury, he had been struck first by its widely-
spacious pastoral life; and secondly, by its monuments of the two great
religions of England—Druidical and Christian.
§ 20. The rain-clouds in this picture are wrought with a care which I
have never seen equalled in any other sky of the same kind. It is the rain
of blessing—abundant, but full of brightness; golden gleams are flying
across the wet grass, and fall softly on the lines of willows in the valley—
willows by the watercourses; the little brooks flash out here and there
between them and the fields. Turn now to the Stonehenge. That, also,
stands in great light; but it is the Gorgon light—the sword of Chrysaor is
bared against it. The cloud of judgment hangs above. The rock pillars
seem to reel before its slope, pale beneath the lightning. And nearer, in
the darkness, the shepherd lies dead, his flock scattered.
§ 22. It was a beautiful thought, yet an erring one, as all thoughts are
which oppose the Law to the Gospel. When people read, “the law came
by Moses, but grace and truth by Christ,” do they suppose that the law
was ungracious and untrue? The law was given for a foundation; the
grace (or mercy) and truth for fulfilment;—the whole forming one
glorious Trinity of judgment, mercy, and truth. And if people would but
read the text of their Bibles with heartier purpose of understanding it,
instead of superstitiously, they would see that throughout the parts which
they are intended to make most personally their own (the Psalms) it is
always the Law which is spoken of with chief joy. The Psalms respecting
mercy are often sorrowful, as in thought of what it cost; but those
respecting the law are always full of delight. David cannot contain himself
for joy in thinking of it,—he is never weary of its praise:—“How love I thy
law! it is my meditation all the day. Thy testimonies are my delight and
my counsellors; sweeter, also, than honey and the honeycomb.”
§ 23. And I desire, especially, that the reader should note this, in now
closing the work through which we have passed together in the
investigation of the beauty of the visible world. For perhaps he expected
more pleasure and freedom in that work; he thought that it would lead
him at once into fields of fond imagination, and may have been surprised
to find that the following of beauty brought him always under a sterner
dominion of mysterious law; the brightness was continually based upon
obedience, and all majesty only another form of submission. But this is
indeed so. I have been perpetually hindered in this inquiry into the
sources of beauty by fear of wearying the reader with their severities. It
was always accuracy I had to ask of him, not sympathy; patience, not
zeal; apprehension, not sensation. The thing to be shown him was not a
pleasure to be snatched, but a law to be learned.
§ 25. Which understanding, let us receive our last message from the
Angel of the Sea.
But this, which is in every one’s power, and is the only thing that God
wants, is just the last thing any one will give Him. We are delighted to
ramble away into day-dreams, to repeat pet verses from other places,
suggested by chance words; to snap at an expression which suits our
own particular views, or to dig up a meaning from under a verse, which
we should be amiably grieved to think any human being had been so
happy as to find before. But the plain, intended, immediate, fruitful
meaning, which every one ought to find always, and especially that which
depends on our seeing the relation of the verse to those near it, and
getting the force of the whole passage, in due relation—this sort of
significance we do not look for;—it being, truly, not to be discovered,
unless we really attend to what is said, instead of to our own feelings.
§ 27. Let us try, by way of example, this 19th Psalm, and see what
plain meaning is uppermost in it.
The word occurring in the Lord’s Prayer, and the thing expressed being
what a child may, with some advantage, be led to look at, it might be
supposed among a schoolmaster’s first duties to explain this word clearly.
Now there can be no question that in the minds of the sacred writers,
it stood naturally for the entire system of cloud, and of space beyond it,
conceived by them as a vault set with stars. But there can, also, be no
question, as we saw in previous inquiry, that the firmament, which is said
to have been “called” heaven, at the creation, expresses, in all definite
use of the word, the system of clouds, as spreading the power of the
water over the earth; hence the constant expressions dew of heaven, rain
of heaven, &c., where heaven is used in the singular; while “the
heavens,” when used plurally, and especially when in distinction, as here,
from the word “firmament,” remained expressive of the starry space
beyond.
§ 28. A child might therefore be told (surely, with advantage), that our
beautiful word Heaven may possibly have been formed from a Hebrew
word, meaning “the high place;” that the great warrior Roman nation,
camping much out at night, generally overtired and not in moods for
thinking, are believed, by many people, to have seen in the stars only the
likeness of the glittering studs of their armor, and to have called the sky
“The bossed, or studded;” but that others think those Roman soldiers on
their might-watches had rather been impressed by the great emptiness
and void of night, and by the far coming of sounds through its darkness,
and had called the heaven “The Hollow place.” Finally, I should tell the
children, showing them first the setting of a star, how the great Greeks
had found out the truest power of the heavens, and had called them “The
Rolling.” But whatever different nations had called them, at least I would
make it clear to the child’s mind that in this 19th Psalm, their whole
power being intended, the two words are used which express it: the
Heavens, for the great vault or void, with all its planets, and stars, and
ceaseless march of orbs innumerable; and the Firmament, for the
ordinance of the clouds.
These heavens, then, “declare the glory of God;” that is, the light of
God, the eternal glory, stable and changeless. As their orbs fail not—but
pursue their course for ever, to give light upon the earth—so God’s glory
surrounds man for ever—changeless, in its fulness insupportable—infinite.
§ 29. The clouds, prepared by the hand of God for the help of man,
varied in their ministration—veiling the inner splendor—show, not His
eternal glory, but His daily handiwork. So He dealt with Moses. I will
cover thee “with my hand” as I pass by. Compare Job xxxvi. 24:
“Remember that thou magnify his work, which men behold. Every man
may see it.” Not so the glory—that only in part; the courses of these stars
are to be seen imperfectly, and but by a few. But this firmament, “every
man may see it, man may behold it afar off.” “Behold, God is great, and
we know him not. For he maketh small the drops of water: they pour
down rain according to the vapor thereof.”
§ 30. “Day unto day uttereth speech, and night unto night showeth
knowledge. They have no speech nor language, yet without these their
voice is heard. Their rule is gone out throughout the earth, and their
words to the end of the world.”
Note that. Their rule throughout the earth, whether inhabited or not—
their law of right is thereon; but their words, spoken to human souls, to
the end of the inhabited world.
“In them hath he set a tabernacle for the sun,” &c. Literally, a
tabernacle, or curtained tent, with its veil and its hangings; also of the
colors of His desert tabernacle—blue, and purple, and scarlet.
Thus far the psalm describes the manner of this great heaven’s
message.
The law is fixed and everlasting; uttered once, abiding for ever, as the
sun, it may not be moved. It is “perfect, converting the soul:” the whole
question about the soul being, whether it has been turned from darkness
to light, acknowledged this law or not,—whether it is godly or ungodly?
But the commandment is given momentarily to each man, according to
the need. It does not convert: it guides. It does not concern the entire
purpose of the soul; but it enlightens the eyes, respecting a special act.
The law is, “Do this always;” the commandment, “Do thou this now:”
often mysterious enough, and through the cloud; chilling, and with
strange rain of tears; yet always pure (the law converting, but the
commandment cleansing): a rod not for guiding merely, but for
strengthening, and tasting honey with. “Look how mine eyes have been
enlightened, because I tasted a little of this honey.”
The statutes are the appointments of the Eternal justice; fixed and
bright, and constant as the stars; equal and balanced as their courses.
They “are right, rejoicing the heart.” But the judgments are special
judgments of given acts of men. “True,” that is to say, fulfilling the
warning or promise given to each man; “righteous altogether,” that is,
done or executed in truth and righteousness. The statute is right, in
appointment. The judgment righteous altogether, in appointment and
fulfilment;—yet not always rejoicing the heart.
§ 35. Thus far the psalm has been descriptive and interpreting. It ends
in prayer.
“Who can understand his errors?” (wanderings from the perfect law.)
“Cleanse thou me from secret faults; from all that I have done against thy
will, and far from thy way, in the darkness. Keep back thy servant from
presumptuous sins” (sins against the commandment) “against thy will
when it is seen and direct, pleading with heart and conscience. So shall I
be undefiled, and innocent from the great transgression—the
transgression that crucifies afresh.
“Let the words of my mouth (for I have set them to declare thy law),
and the meditation of my heart (for I have set it to keep thy
commandments), be acceptable in thy sight, whose glory is my strength,
and whose work, my redemption; my Strength, and my Redeemer.”
2 I do not mean that Correggio is greater than Turner, but that only his way
of work, the touch which he has used for the golden hair of Antiope for
instance, could have painted these clouds. In open lowland country I have
never been able to come to any satisfactory conclusion about their height, so
strangely do they blend with each other. Here, for instance, is the arrangement
of an actual group of them. The space at a was deep, purest ultramarine blue,
traversed by streaks of absolutely pure and perfect rose-color. The blue passed
downwards imperceptibly into gray at g, and then into amber, and at the white
edge below into gold. On this amber ground the streaks p were dark purple,
and, finally, the spaces at b b, again, clearest and most precious blue, paler
than that at a. The two levels of these clouds are always very notable. After a
continuance of fine weather among the Alps, the determined approach of rain
is usually announced by a soft, unbroken film of level cloud, white and thin at
the approaching edge, gray at the horizon, covering the whole sky from side to
side, and advancing steadily from the south-west. Under its gray veil, as it
approaches, are formed detached bars, darker or lighter than the field above,
according to the position of the sun. These bars are usually of a very sharply
elongated oval shape, something like fish. I habitually call them “fish clouds,”
and look upon them with much discomfort, if any excursions of interest have
been planned within the next three days. Their oval shape is a perspective
deception dependent on their flatness; they are probably thin, extended fields,
irregularly circular.
Fig. 98.
4 I assume the ἅυπνοι κρῆναι νομάδες to mean clouds, not springs; but
this does not matter, the whole passage being one of rejoicing in moisture and
dew of heaven.
6 I have been often at great heights on the Alps in rough weather, and have
seen strong gusts of storm in the plains of the south. But, to get full expression
of the very heart and meaning of wind, there is no place like a Yorkshire moor.
I think Scottish breezes are thinner, very bleak and piercing, but not
substantial. If you lean on them they will let you fall, but one may rest against
a Yorkshire breeze as one would on a quickset hedge. I shall not soon forget,—
having had the good fortune to meet a vigorous one on an April morning,
between Hawes and Settle, just on the flat under Wharnside,—the vague sense
of wonder with which I watched Ingleborough stand without rocking.
7 When there is a violent current of wind near the ground, the rain columns
slope forward at the foot. See the Entrance to Fowey Harbor, of the England
Series.
8 See Part IX. chap. 2, “The Hesperid Æglé.”
9 The reader must remember that sketches made as these are, on the
instant, cannot be far carried, and would lose all their use if they were finished
at home. These were both made in pencil, and merely washed with gray on
returning to the inn, enough to secure the main forms.
10 I do not say this carelessly, nor because machines throw the laboring
man “out of work.” The laboring man will always have more work than he
wants. I speak thus, because the use of such machinery involves the
destruction of all pleasures in rural labor; and I doubt not, in that destruction,
the essential deterioration of the national mind.
11 You may see the arrangement of subject in the published engraving, but
nothing more; it is among the worst engravings in the England Series.
14 I believe few sermons are more false or dangerous than those in which
the teacher professes to impress his audience by showing “how much there is
in a verse.” If he examined his own heart closely before beginning, he would
often find that his real desire was to show how much he, the expounder, could
make out of the verse. But entirely honest and earnest men often fall into the
same error. They have been taught that they should always look deep, and that
Scripture is full of hidden meanings; and they easily yield to the flattering
conviction that every chance idea which comes into their heads in looking at a
word, is put there by Divine agency. Hence they wander away into what they
believe to be an inspired meditation, but which is, in reality, a meaningless
jumble of ideas; perhaps very proper ideas, but with which the text in question
has nothing whatever to do.
PART VIII.
OF IDEAS OF RELATION:—FIRST, OF
INVENTION FORMAL.
—————
CHAPTER I.
THE LAW OF HELP.
§ 1. We have now reached the last and the most important part of
our subject. We have seen, in the first division of this book, how far art
may be, and has been, consistent with physical or material facts. In its
second division, we examined how far it may be and has been obedient
to the laws of physical beauty. In this last division we have to consider its
relations of art to God and man. Its work in the help of human beings,
and service of their Creator.
We have to inquire into the various Powers, Conditions, and Aims of
mind involved in the conception or creation of pictures; in the choice of
subject, and the mode and order of its history;—the choice of forms, and
the modes of their arrangement.
And these phases of mind being concerned, partly with choice and
arrangement of incidents, partly with choice and arrangement of forms
and colors, the whole subject will fall into two main divisions, namely,
expressional or spiritual invention; and material or formal invention.
I have often been accused of slighting this quality in pictures; the fact
being that I have avoided it only because I considered it too great and
wonderful for me to deal with. The longer I thought, the more wonderful
it always seemed; and it is, to myself personally, the quality, above all
others, which gives me delight in pictures. Many others I admire, or
respect; but this one I rejoice in. Expression, sentiment, truth to nature,
are essential; but all these are not enough. I never care to look at a
picture again, if it be ill composed; and if well composed I can hardly
leave off looking at it.
No. Precisely the contrary. Composed as only the man who did it could
have done it; composed as no other picture is, or was, or ever can be
again. Every great work stands alone.
§ 3. Yet there are certain elementary laws of arrangement traceable a
little way; a few of these only I shall note, not caring to pursue the
subject far in this work, so intricate it becomes even in its first elements:
nor could it be treated with any approach to completeness, unless I were
to give many and elaborate outlines of large pictures. I have a vague
hope of entering on such a task, some future day. Meantime I shall only
indicate the place which technical composition should hold in our scheme.
And, first, let us understand what composition is, and how far it is
required.
I wish the reader to dwell a little on this word “Help.” It is a grave one.
But in a plant, the taking away of any one part does injure the rest.
Hurt or remove any portion of the sap, bark, or pith, the rest is injured. If
any part enters into a state in which it no more assists the rest, and has
thus become “helpless,” we call it also “dead.”
The power which causes the several portions of the plant to help each
other, we call life. Much more is this so in an animal. We may take away
the branch of a tree without much harm to it; but not the animal’s limb.
Thus, intensity of life is also intensity of helpfulness—completeness of
depending of each part on all the rest. The ceasing of this help is what
we call corruption; and in proportion to the perfectness of the help, is the
dreadfulness of the loss. The more intense the life has been, the more
terrible is its corruption.
The idea is clear and mighty in the cherubim’s cry: “Helpful, helpful,
helpful, Lord God of Hosts;” i.e. of all the hosts, armies, and creatures of
the earth.2
§ 7. Perhaps the best, though the most familiar example we could take
of the nature and power of consistence, will be that of the possible
changes in the dust we tread on.
ebookbell.com