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)

Learning Swift


Apple released Swift officially as an alternative language for development, apart from Objective-C. It looks and reads like an easy-to-use scripting-like language. It is a modern language, and has the features of most modern languages such as Python, Ruby, Lua and Scala. Swift removes the need for semicolons and uses the standard double slash for comments, amongst other things, as shown here:

//This is a comment

Console output printing

The println function is used for printing data. Swift also has a more evolved println function that allows for formatted printing. The value of a variable can be inserted into a string by enclosing the variable name in brackets preceded by a slash: \(varname). This format has to be enclosed in double quotes to make it work.

println("Hello World")
println("This is fine too");

var ver = 6
println("Hello from Xcode \(ver)")

Working with variables

We can add two numbers, say 1 and 3, but if our program just added 1 and 3, we would not have much use of...