Chapter 5. Hello World

This chapter fulfills the obligation of all self-respecting tutorials to include a Hello World program. The chapter’s tutorial shows you how to use the Project Builder application described in Chapter 4, to create a project that builds a Hello World program for Cocoa. Hello World represents the simplest possible working program that does something detectable (like printing a string to the screen). A working Hello World program verifies that your development environment is functioning properly.

Creating the Project

The simplest type of Cocoa program is called a Foundation tool. Because this type of program uses only the Foundation framework, it has no graphical user interface (GUI). A Cocoa program that has no GUI is called a tool, to clearly distinguish it from a Cocoa program that does have a GUI, which is called an application. Unlike Cocoa applications that use the Application Kit Framework (detailed in Chapter 1), Foundation tools can be run only from within Project Builder and from the command line.

Foundation tools are a great way to quickly create very powerful command-line applications for use in the Mac OS X BSD environment. A Foundation tool is very similar to a standard C program but, because it links with the Foundation framework, it has access to all the power of the Foundation classes in addition to the standard Objective-C constructs.

In this section you’ll be led through the steps necessary to create a very simple foundation tool that ...

Get Learning Cocoa now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.