O'Reilly logo

Swift Quick Syntax Reference by Matthew Campbell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter    3

Printing Variables and Constants

When you are prototyping your code with playgrounds, you automatically get output for any variable or constant that you are working with. But, if you are coding an application, you will need to use special functions to print out values to the console screen.

Since playgrounds have no console window, you will need to create a new Mac command-line tool to print values to a console screen.

Creating a Command-Line Tool

Open Xcode 6 and then choose Create a new Xcode project from the welcome screen.

On the screen that appears, choose OS X image Application Command Line Tool.

Click Next.

On the next screen, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required