From the course: Make SwiftUI Playgrounds Applications

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Constant and calculations

Constant and calculations

- [Steven] We've got an application started, but it is very hard to change to do anything with it. If I wanted something other than guitars, such as a light bulb or TV, I'd have to change the entire program. Swift Playgrounds, and it's bigger brother on the Mac, Xcode, have special programs called compilers and interpreters. These take our typed words and make them readable by the chips inside your iPad or Mac. Other languages use interpreters, too, such as JavaScript in your web browser. Swift, and most programming languages, have a way for developers to tell that there is a name for a value. We call this a constant. In Swift, we assign it like this one. So I'm going to put one right here. So if you go right underneath ContentView here, I'm going to add let thing equal quote guitars. The let is a keyword, a special word that tells Swift that what follows it is an assignment of a constant. Once you define an…

Contents