“Hello, World” SwiftUI
Let’s get started
--
SwiftUI has been around for over a year. Now we have had longer than a Year to start working with SwiftUI. Isn’t it time we got started?
Difficulty: Beginner | Easy | Normal | Challenging
This article has been developed using Xcode 11.5, and Swift 5.2.4
Prerequisites:
- Be able to produce a “Hello, World!” Swift application
- Be able to download a repo from GitHub (If you choose you want to!)
Terminology
Swift: An open source programming language for macOS, iOS, watchOS and tvOS and others
SwiftUI: A simple way to build user interfaces Across Apple platforms
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. We are going to display “Hello,World!” on a label displayed on the phone screen.
The step-by-step
Creating a new Project in Xcode
You need to have Xcode installed on your Mac. This can be downloaded from HERE. If you don’t already have this installed, do so now. Once you have done that, you can click on the Xcode icon
This opens up the IDE, and the first thing we are going to do is create a new project.