Swift tutorial for beginners Part 1

Developing iOS Apps Using Swift

Fabio Rocha
Swift tutorial for beginners


So as you all may know, Apple just just announced Swift for iOS 8 (not Taylor Swift), which is kinda exciting since Swift looks so easy to learn! In this part of the tutorial I will only cover some simple aspects of the new way of coding iOS.

“Swift is a new programming language for iOS and OS X apps that builds on the best of C and Objective-C, without the constraints of C compatibility”

Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/pt/jEUH0.l

First things first, make sure that you’ve download Xcode 6 from https://developer.apple.com/ and create a new project.

Create an Empty Application, we will start from scratch

Make sure that you select “Swift” as coding language:

Creating new project on Xcode 6

We will end up with something like


As you may see, this has nothing to due with objective-C, but at the same time the structure keeps the same for AppDelegate. Also we have lost the Header file (.h), and now we only have a single swift file.

Lets add a Root View Controller and see how it goes ☺

Setting root view controller on Swift

And finally, build!

Test build for our app

For the ones with web development background, some things on Swift will look a lot like Javascript, lets compare variable assignment:

This is what Objective-c array definition looks like
This is how Swift array definition looks like

Did I mention how easy it is now do manipulate Strings with Swift?

Also you may have noticed that now we have let and var, the difference between them is that let defines a constant and var defines an usual variable.

On the next part of this series we will learn how to define a class and we will create a simple app.

Meanwhile you can take a look at this awesome Cheat sheet from @rwenderlich

See you later!