Let’s start with the fundamentals of Swift programming language. To run Swift, you need to download either Xcode or Swift Playgrounds, both available for free on Mac App Store. Since Xcode is a really heavy full-blown development environment, we will start with considerably less demanding Swift Playgrounds.
Go ahead and install it on your Mac. When you open it, you should see an empty list of playgrounds.
Let’s create a new one by choosing File -> New Blank Playground from the top menu, or via ⌘ N shortcut.
Now, click into the window and write this code:
Open the console by clicking the icon at the bottom-right corner:
Finally, run your code by clicking the button next to the Console button:
Cool! You’ve just written and run your first Swift code!
Don’t worry if you don’t understand something, I will explain everything introduced in this article in the rest of this series.
Now, let’s play with print() for a bit. Write this below your existing code and notice how it’s printed on the console in the order that matches the order of the code: