Swift tutorial for beginners Part 1

Developing iOS Apps Using Swift

Fabio Rocha
Jun 3, 2014 · 3 min read

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

AppDelegate.swift

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!

PART 2

Swift tutorial for beginners

Tutorial to develop apps with iOS and Swift

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store