Your first Swift Application — without a Mac OR Xcode
Using Xcode requires a Mac, but you can code in Swift without either!
--
Many tutorials seem to indicate that you need a Mac with the Xcode IDE to start coding an using Swift. This is not entirely true. Scrub that, it’s not true at all.
This tutorial uses Swift (any version is fine) and covers using an online IDE which at the time of writing (December 2019) defaults to Swift 5.1. You may of course use your installed version of Xcode.
Terminology
Character: A written character, usually associated with a letter of the alphabet
Console: A simple window for programming that can display output and (usually) process input
“Hello, World!”: A program or script that outputs “Hello World” to the console or has some other way of displaying the appropriate message
Integrated Development Environment (IDE): An application that provides a set of features that are used by software developers to create computer software
Online IDE: An IDE which can run your code through the Internet (often leveraging a browser)
Swift: An open source programming language for macOS, iOS, watchOS and tvOS
String: A collection of Characters
Why Hello World!?
Simple tutorials usually begin with a “Hello world” tutorial. Those outside the programming community can feel that this is an unusual thing to choose, as it seems to have been picked simply because it is a simple word String (or just String) to print to the screen.
But why would anyone choose that particular String?
We can start at the beginning. There is a book about C programming which used a “Hello, World!” example — although this was actually lifted from a Programming in C: A Tutorial (1974) book.
The actual “Hello, World!” application that tutorials ask you to produce vary in sophistication and implementation, but the basic idea is that you print “Hello, World!” in some form.
With that settled, let us move on.