From the course: Complete Guide to SwiftUI
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Text views
- [Instructor] We have a few elements in stacks, and we need to deep dive those elements a bit more. Starting with the text element. You've seen the basics of text. Text takes a string and outputs it on the device. However, text has little control of its alignment. For that, you need spacers and stack alignments. I'll add a description to my pizza in a Vstack. So let's go over here to where we have the margherita and I'm going to Command, click that, and I'm going to embed it in a Vstack. And then underneath that, I'm going to add more text, and we'll call that description. Okay, now you can see over here, and let's zoom in a little bit, you can see those aren't exactly aligned perfectly. They're actually aligned by center, which is its default setting. I'm going to want to really do this by a leading, which is the left side, again, this is localized, so leading would be left side for left to right. And if I were to change this over to a right to left, be it Arabic or Hebrew or…
Contents
-
-
-
-
(Locked)
Embed a stack view6m 29s
-
(Locked)
Text views3m 41s
-
(Locked)
Image views with SF Symbols5m 22s
-
(Locked)
Iteration with ForEach5m 13s
-
(Locked)
Images and assets4m 56s
-
(Locked)
Labels2m 22s
-
Add view2m 49s
-
(Locked)
Challenge: Add views26s
-
(Locked)
Solution: Add views2m 33s
-
(Locked)
Extract subviews8m 4s
-
(Locked)
Subviews with parameters6m 37s
-
(Locked)
Challenge: Ratings view44s
-
(Locked)
Solution: Ratings view3m 55s
-
(Locked)
-
-
-
-
-
-
-
-
-
-
-
-
-
-