TweetFollow Us on Twitter

Project Builder Revealed

Volume Number: 19 (2003)
Issue Number: 4
Column Tag: Getting Started

Project Builder Revealed

by Dave Mark

In this month's column, we're going to explore some of Project Builder's nooks and crannies. The column started on a completely different tack, when I found myself trying to find the definition for a specific class function. I dug through the /Developer/Documentation/ directory, which is absolutely worth doing, but there's a lot of doc there.

I went on line to ask some of my Project Builder buddies how they would go about solving this particular problem and got a bunch of different responses, all of which led to the same end, and each of which taught me something new about Project Builder. This month, I'd like to share what I've learned with you.

Creating CrannyTester

Let's start off by creating a new project, called CrannyTester. Launch Project Builder, select New Project... from the File menu, scroll down to the bottom of the New Project window and create a Foundation Tool project. Name the project CrannyTester.

One Window, Some, or Many?

One Project Builder feature I really like is the ability to customize PB's use of windows. Select Preferences... from the Project Builder menu, then click on the Task Templates icon at the top of the prefs window. Now click on the Basic Settings tab (Figure 1).


Figure 1. The window template settings in the Preferences... dialog.

As you can see, there are four basic window setups. Single Window forces the entire Project Builder interface into a single swiss-army-knife of an interface, a single window filled with tabbed panes (Figure 2). If you are working on a laptop or on a smaller monitor, this is a very efficient way to go.


Figure 2. The CrannyTester project in Single Window mode.

    One bit of funkiness to be aware of: When you change selections in the Task Templates preference panes, your changes won't take effect until you open a new window. To get the change to affect your current project, make the change, then close your project and reopen it.

    To see this for yourself, set the preference to Single Window, then open a project or create a new one. A set of horizontal tabs (similar to the Find/Build/Run/Debug/CVS tags in Figure 2) will appear in the window.

    Now go into preferences and change to Some Windows. Even if you click the Apply button, the tabs will still be visible. Now close the project and reopen it. The tabs disappear as the Some Windows preference is applied.

    Chances are, you'll pick a mode you like, then create all your projects in that mode. If you do find yourself playing with the windowing modes, be sure to reopen the project to see the effect properly.

"Some Windows" adds separate windows for Find, Build and Debug. "Many Windows" opens everything in its own window and feels most like CodeWarrior to me. I spend most of my time in Some Windows but love the flexibility of switching to Single Window when I'm on the road. Sweet!

Finding the Doc

Now that you've got your project setup the way you like it, I'd like to share another Project Builder nook with you. Or maybe it's a cranny. Hmmm.

Open the CrannyTester project you created at the beginning of this month's column. Click on the Files tab, open the Source triangle, and click on the source file main.m. Here's the source code you should see:

#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
  NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];
    // insert code here...
    NSLog(@"Hello, World!");
    [pool release];
    return 0;
}

This is the default source for a Foundation Tool and should look reasonably familiar to you. One of the keys to understanding any new framework is the ability to find descriptions of the classes and utility functions that you encounter in the framework's documentation. One thing Apple's dev tools have no shortage of is documentation. While I do recommend that you spend some time prowling through the /Developer/Documentation/ subdirectories, there are some clever little shortcuts built into Project Builder that will bring you right to the pages you are looking for.

Let's start with the most obvious path. If you click on the Classes tab, you'll see a list of classes in the upper pane, with a list (empty, right now) of members in the lower pane. Below that is a popup menu that should be set to "Heirarchy, all classes" with an Options button to its right (See Figure 3.)


Figure 3. The Classes tab, with its list of classes.

Lets say you wanted to read up on the NSObject class (and you should). NSObject is the root of most of the classes you'll use to develop your Cocoa applications. Click on NSObject in the Class pane. You'll immediately see a list of its member functions in the lower pane. Click on a member function, and that function's declaration appears in the main editing pane.

Now for the coolness. Notice that little blue book icon to the left of the NSObject entry in the Class pane? Click on it. Ka-ching! The NSObject documentation appears in the editing pane. Apple's documentation is extensive. For each class, you'll learn where the class fits into the class hierarchy, protocols it conforms to, in what include files it is declared, methods and fields (with lots of "see also" links), and more. At the very least, spend some time reading about the NSObject class, since the vast majority of your classes will inherit from this class.

Here's another example: Go back to the Class pane and click on the triangle to the left of NSObject. This will reveal the classes derived from NSObject. Near the top of that list is NSArray. Click on the triangle to the left of NSArray, revealing NSMutableArray. Click on the book icon for NSMutableArray. The doc for NSMutableArray will appear in the main pane (see Figure 4).


Figure 4. The documentation for NSMutableArray.

Notice that the doc lists the inheritance hierarchy NSArray : NSObject. As you can see, you've got several ways to find your class in the hierarchy. You can use the triangles to drill down through a parent class. You can also use the "Inherits from" links in the doc to get to an ancestor class.

Now take a look at the popup menu at the bottom of the Members pane. It currently reads "Hierarchy, all classes". There are some other choices as well. Selecting "Hierarchy, project classes" will restrict the class list to classes you've declared in your project. "Flat, all classes" gives you a straight alphabetical listing of all classes, irrespective of hierarchy. This is very useful when you know the name of a class, but don't know where it sits in the class tree. "Flat, project classes" does the same thing, but restricts the list to classes used by your project.

Another nice Project Builder feature is that you can add your own customized views to this list. Figure 5 shows the dialog that appears when you click the Options button to the right of the popup menu. Basically, you use the controls in the dialog to customize the class listing, then click the Add... button. When prompted, name your custom listing, and it will appear in the popup menu along with the other listings. Spend a few minutes playing with this dialog, just so you have a sense of what options are available to you.


Figure 5. This dialog appears when you click the Options button in the Classes tab.

Other Paths to the Documentation

As you might expect, there are other ways to get from a symbol to its documentation. In your CrannyTester project, click on the Files tab, then open the Source triangle and click on main.m. Now hold down the option key and double-click on the class name NSAutoreleasePool.

Ta-daa! Project Builder takes you straight to the doc page for NSAutoreleasePool. To get back to your source code, click on the "back" button (the button the cursor is pointing to in Figure 6). Go ahead, click on it. Just like your browser, it takes you back to the previous page, in this case, your source code.


Figure 6. The cursor is pointing to the back button.

Let's try another experiment. This time, hold down the command key and double-click on NSAutoreleasePool. Instead of jumping to the doc, Project Builder jumps to the declaration of NSAutoreleasePool in NSAutoreleasePool.h.

Notice the two popup menus to the right of the back and forward browser buttons. The first popup (Figure 7) lists the recently visited frames, including source code and documentation. The second popup (Figure 8) allows you to jump to individual declarations within the current source file.


Figure 7. The first popup to the right of the browser buttons shows recently visited files.


Figure 8. The second popup lets you jump to the declarations within the current file.

Till Next Month...

There are a lot more elements worth exploring within Project Builder but, unfortunately, I've run out of room. More cool stuff next month, plus we'll dig into some actual code. See you then.


Dave Mark is a long-time Mac developer and author and has written a number of books on Macintosh development, including Learn C on the Macintosh, Learn C++ on the Macintosh, and The Macintosh Programming Primer series. Be sure to check out Dave's web site at http://www.spiderworks.com.

 
AAPL
$517.96
Apple Inc.
-3.72
MSFT
$39.75
Microsoft Corpora
+0.57
GOOG
$536.44
Google Inc.
+3.92

MacTech Search:
Community Search:

Software Updates via MacUpdate

Starcraft II: Wings of Liberty 1.1.1.180...
Download the patch by launching the Starcraft II game and downloading it through the Battle.net connection within the app. Starcraft II: Wings of Liberty is a strategy game played in real-time. You... Read more
Sibelius 7.5.0 - Music notation solution...
Sibelius is the world's best-selling music notation software for Mac. It is as intuitive to use as a pen, yet so powerful that it does most things in less than the blink of an eye. The demo includes... Read more
Typinator 5.9 - Speedy and reliable text...
Typinator turbo-charges your typing productivity. Type a little. Typinator does the rest. We've all faced projects that require repetitive typing tasks. With Typinator, you can store commonly used... Read more
MYStuff Pro 2.0.16 - Create inventories...
MYStuff Pro is the most flexible way to create detail-rich inventories for your home or small business. Add items to MYStuff by dragging and dropping existing information, uploading new images, or... Read more
TurboTax 2013.r17.002 - Manage your 2013...
TurboTax guides you through your tax return step by step, does all the calculations, and checks your return for errors and overlooked deductions. It lets you file your return electronically to get... Read more
TrailRunner 3.8.769 - Route planning for...
Note: While the software is classified as freeware, it is actually donationware. Please consider making a donation to help support development. TrailRunner is the perfect companion for runners,... Read more
Flavours 1.1.10 - Create and apply theme...
Flavours is a Mac application that allow users to create, apply and share beautifully designed themes. Classy Give your Mac a gorgeous new look by applying delicious themes! Easy Unleash your... Read more
Spotify 0.9.8.296. - Stream music, creat...
Spotify is a streaming music service that gives you on-demand access to millions of songs. Whether you like driving rock, silky R&B, or grandiose classical music, Spotify's massive catalogue... Read more
SlingPlayer Plugin 3.3.20.475 - Browser...
SlingPlayer is the screen interface software that works hand-in-hand with the hardware inside the Slingbox to make your TV viewing experience just like that at home. It features an array of... Read more
S.M.A.R.T. for USB and FireWire Drives 0...
S.M.A.R.T. for USB and FireWire Drives is a kernel driver for OS X external usb or firewire drives. It extends the standard driver behaviour by providing access to drive smart data. The interface to... Read more

Latest Forum Discussions

See All

148Apps Live on Twitch: Pivvot’s Looper...
On our latest Twitch stream, we’ll be playing a pair of minimalist arcade games, one that just got a big content update in Pivvot, and another that was inspired by it in 15 Coins. Whitaker Trebella, creator of Pivvot, will discuss the new modes... | Read more »
Word Cubes Review
Word Cubes Review By Jordan Minor on April 15th, 2014 Our Rating: :: SQUARESVILLEUniversal App - Designed for iPhone and iPad Word Cubes is fine, but it is barely any different from any other word game.   | Read more »
PAX East 2014 – Desert Fox: The Battle o...
PAX East 2014 – Desert Fox: The Battle of El Alamein is Coming to iOS Soon Posted by Rob Rich on April 15th, 2014 [ permalink ] Shenandoah Studio has become one of the go-to developers for war games on iOS, with | Read more »
Tank of Tanks Review
Tank of Tanks Review By Carter Dotson on April 15th, 2014 Our Rating: :: TANKS A LOT!iPad Only App - Designed for the iPad This multiplayer game played on a single iPad is simple, chaotic fun.   | Read more »
PAX East 2014 – Dungeon of the Endless J...
PAX East 2014 – Dungeon of the Endless Just Might Have a Shot at an iPad Release Posted by Rob Rich on April 15th, 2014 [ permalink ] I think it’s fair to say that | Read more »
SideSwype Review
SideSwype Review By Carter Dotson on April 15th, 2014 Our Rating: :: ON YOUR SIDEUniversal App - Designed for iPhone and iPad SideSwype is a puzzler that takes inspiration from Threes, but becomes its own incredibly fun game.   | Read more »
PAX East 2014 – Bigfoot Hunter Invites P...
PAX East 2014 – Bigfoot Hunter Invites Players on a Wild and Wooly Photo Safari Posted by Rob Rich on April 15th, 2014 [ permalink ] Yeti. Sasquatch. Wendigo. | Read more »
Dungeon Quest Review
Dungeon Quest Review By Cata Modorcea on April 15th, 2014 Our Rating: :: NO STORY, BUT GOOD FUNUniversal App - Designed for iPhone and iPad Dungeon Quest does a lot of things right, but ultimately forgets about one of the core... | Read more »
Tempo AI and Speek Join Forces to “Kill...
Tempo AI and Speek Join Forces to “Kill the Conference Call PIN” Posted by Rob Rich on April 15th, 2014 [ permalink ] Today Tempo AI, makers of Tempo Smart Calendar, and | Read more »
Fighting Fantasy: Starship Traveller Rev...
Fighting Fantasy: Starship Traveller Review By Jennifer Allen on April 15th, 2014 Our Rating: :: A SIGNIFICANT VOYAGEUniversal App - Designed for iPhone and iPad Continuing the release of Fighting Fantasy titles, Starship Traveller... | Read more »

Price Scanner via MacPrices.net

Save $50 on Mac mini Server
B&H Photo has the 2012 Mac mini Server on sale for $949 including free shipping plus NY sales tax only. Their price is $50 off MSRP. Read more
PhatWare’s “Ultimate Writing App For iOS” Ren...
PhatWare Corp. has announced it has renamed its new WritePro word processing app for iPhone and iPad: WritePad Pro. The decision to change the app’s name to leverages the strong brand awareness and... Read more
Full Resolution Photo Editor Tint Mint 1.0 Re...
California based independent developer, Jeffrey Sun, creator of the iOS app Modern Editor, has released Tint Mint, a new photography app for editing enthusiasts. The app costs a dollar, and it packs... Read more
16GB iPad mini (Apple refurbished) available...
The Apple Store has refurbished 1st generation 16GB iPad minis available for $249 including free shipping. Both black and white models are available. Read more
Save $120 on the 27-inch 3.2GHz Haswell iMac
B&H Photo has the 27″ 3.2GHz iMac on sale for $1679.99 including free shipping plus NY sales tax only. Their price is about $120 off MSRP. Read more
Using a Mac Doesn’t Eliminate The Heartbleed...
Low End Mac’s Dan Knight notes that any time you visit a website with an https: prefix or see that secure lock icon on your browser, some type of security software is busy trying to protect your data... Read more
AirPrint Basics Tutorial Posted
A new Apple Knowledge Base article helps get you started using AirPrint, the Apple protocol that enables instant printing from iPad, iPhone, iPod touch, and Mac without the need to install drivers or... Read more
Speed Tips For Running LibreOffice On The Mac
LibreOffice is my favorite of several free, open-source application suites, and the one I have configured on my Mac as my default app for Word documents that one frequently has to deal with. It also... Read more
Snag a 15-inch Retina MacBook Pro for $115 of...
B&H Photo has 2013 15″ Retina MacBook Pros on sale for up to $115 off MSRP for a limited time. Shipping is free, and B&H charges NY sales tax only: - 15″ 2.3GHz Retina MacBook Pro: $2489.99... Read more
MacBook Airs on sale for $50 to $100 off MSRP
Several resellers are offering $50-$100 discounts on 11″ and 13″ MacBook Airs today, including Amazon, Best Buy, B&H, and others. See the breakdown of deals on our MacBook Air Price Tracker,... Read more

Jobs Board

*Apple* Retail - Market Leader - Cincinnati...
…challenges of developing individuals, building teams, and affecting growth across Apple Stores. You demonstrate successful leadership ability - focusing on excellence Read more
*Apple* Retail - Manager - SoHo - Apple (Uni...
Job SummaryKeeping an Apple Store thriving requires a diverse set of leadership skills, and as a Manager, you're a master of them all. In the store's fast-paced, dynamic Read more
Position Opening at *Apple* - Apple (United...
**Job Summary** Every day, business customers come to the Apple Store to discover what powerful, easy-to-use Apple products can do for them. As a Business Leader, Read more
Position Opening at *Apple* - Apple (United...
…challenges of developing individuals, building teams, and affecting growth across Apple Stores. You demonstrate successful leadership ability - focusing on excellence Read more
Position Opening at *Apple* - Apple (United...
…Summary** As a Specialist, you help create the energy and excitement around Apple products, providing the right solutions and getting products into customers' hands. You Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.