From the course: Make SwiftUI Playgrounds Applications
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Formatted numbers - Swift Tutorial
From the course: Make SwiftUI Playgrounds Applications
Formatted numbers
- [Instructor] We've learned about the difference between numbers and strings, that they don't play well together, and how to use interpolation to get them to behave. However, interpolation doesn't always work nicely. So we're going to open up a new playground file, and that's the one with the rectangle. And we can open that up, go into it. And you get a nice blank page here. So we're going to enter some code here. So I'm just going to tap to enter code. And so we're going to start with import and then foundation. And that adds a library of standard classes and methods that will come in handy, most importantly our formatters. And then underneath that I'm going to make a constant pi. I'm going to go ahead and use this print statement here. And print works the same way as text, except that it takes anything. Instead of only taking strings, it can take numbers as well, like I did here. All right, and with all that I can tap run…
Contents
-
-
-
(Locked)
More on the view hierarchy12m 11s
-
(Locked)
Formatted numbers8m 23s
-
(Locked)
Computed properties6m 7s
-
(Locked)
Arrays9m 54s
-
(Locked)
For loops9m 42s
-
(Locked)
Use ForEach in SwiftUI8m 32s
-
(Locked)
Protocols, Hashable, and Identifiable3m 56s
-
(Locked)
Importing models and assets8m 27s
-
(Locked)
Adapting models8m 43s
-
(Locked)
Scroll view and list6m 34s
-
Work with @State and toggle buttons8m 43s
-
(Locked)
Make Button arrays7m 13s
-
(Locked)
Work with @Binding5m 59s
-
(Locked)
Enumeration types8m 45s
-
(Locked)
Selection from lists4m 21s
-
(Locked)
Optional values6m 10s
-
(Locked)
-