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

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