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.
Labels
- [Instructor] We've seen images in text, but you can combine them together called the label. This combination is especially important for buttons to have both icons and text. There's variations of the label. Well, you can break them into simple and custom. The simple takes a string and either an image or SF symbol. For example, I can add an image to the order pizza stack like this. So let's go up to a bit in the code here and where it says order pizza, I'll put right before that label and you can see the types that you've got there. But I'm just going to put some quotes here and put in cart and then comma and then system image. And you can put in cart here too. I got cart from before and then it compiles and I get a leading icon with the word cart. The second version of the label uses closures for the text and icon. I also want to put the total order next to the cart. I can use the image I created earlier in a formatted text like this. So I'm going to go over here to where this image…
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)
-
-
-
-
-
-
-
-
-
-
-
-
-
-