Book Image

Xcode 6 Essentials

By : Jayant Varma
Book Image

Xcode 6 Essentials

By: Jayant Varma

Overview of this book

<p>Apple made their iOS devices easy to use and now they have extended that to their development tools such as Xcode. In Xcode, you can create native applications in the easiest way. Apple's new Xcode technology is making the development curve smoother with its easy-to-develop features and enhancements.</p> <p>Xcode can now write code with the performance-upgraded, brand new, innovative language called Swift, so you no longer need to rely on third-party frameworks to create applications.</p> <p>The book gives you a tour of the new features of Xcode 6. It introduces some important aspects such as the Swift language and its Playgrounds with visual live coding, creating interfaces, storyboards, controllers, frameworks, and live previews. Diving more into the subject, this books shows you how to debug your code, and how to build and test the application on a device or the simulator.</p>
Table of Contents (15 chapters)

Swift Playgrounds


For this chapter, we shall look at this brilliant new feature called Playground. You can simply type the code you see in this chapter in a Playground, and it will run and show the results without having to compile or run the application. However, there are a few things to note before we start:

  • The language supported by Playgrounds is a new language called Swift, introduced by Apple. You cannot have (as yet) a Playground with Objective-C as the code language.

  • The entire file is a single Playground and called so too. This means that the compiler treats it like a single source file. This can give rise to issues where, for example, if you used a variable called temp as string, and further down you used it as an int, the compiler would throw an error complaining that the variable is being redefined.

  • The code you can type in a Playground is specific to the platform of the Playground, that is, iOS or OS X. This affects the code in terms of the classes available for use, CocoaTouch...