Swift Basics

Introduction

Hi, my name is Jan Zavrel, and I’m an author of the website codewithjan.com.

Swift is one of the fastest growing programming language created by Apple in 2014. Swift makes it easy to write fast and safe programs.

If you want to learn the basics of Swift, you’ve come to the right place. I’ve created this course as a series of short articles and each bite-sized part will teach you a specific feature in just a few seconds.

What is programming

Programming is giving a set of instructions to a computer to execute. It’s like providing a recipe to cook something. Computer simply follows the instructions and the more complex they are, the more complex the result.

Programming plays a key role in how we participate in politics, how we buy things, and how we stay in touch with one another. While learning to program may initially be frustrating, if you choose to stick with it, you’ll be able to make some brilliant things.

Swift and Xcode

To start, you’ll need Xcode installed on your Mac. Xcode is available for free from the Mac App Store. Once it’s installed on your Mac, run it and choose File -> New -> Playground…

enter image description here

Or you can use the ⌥⇧⌘N shortcut.

Playground is a sandbox where you can write your code on the left and get immediate results on the right.

Keep the default settings (Blank playground for iOS) and hit the Next button. You can name your playground and save it to the location of your choice.

enter image description here

You should see your playground and first, you want to click that top left icon to hide the directory structure so it won’t distract you for now.

enter image description here

Alright! You’re all set and we can start learning Swift.

Next: Variables »