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 - Swift Tutorial
From the course: Make SwiftUI Playgrounds Applications
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
-
-
First steps8m 56s
-
(Locked)
Constant and calculations7m 57s
-
(Locked)
Functions, methods, and modifiers7m 14s
-
(Locked)
HStack, VStack, and layout9m 41s
-
(Locked)
Create new files and views4m 50s
-
(Locked)
Add images10m 10s
-
(Locked)
Learn about Swift types9m 32s
-
(Locked)
Variables and scope10m 33s
-
(Locked)
Using if{}else{}8m 24s
-
(Locked)
More if{}else{}12m 46s
-
(Locked)
Create custom functions7m 58s
-
(Locked)
Structs and classes10m 55s
-
Models and views10m 37s
-
-
-