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.
Basic backgrounds
From the course: Complete Guide to SwiftUI
Basic backgrounds
- [Instructor] We've looked at foregrounds. Now let's look at backgrounds. Until we set a nice color for the foreground, we used a background modifier to help us see the title in the header view. You could use background modifiers in any view, replacing the transparent background with a color. Now we have several of the same choice for colors we had for foregrounds plus a few more. Commonly, you'll place backgrounds on stacks or views, giving a background to all the stacks or views. For example, I'm going to go into order view here, and I could put this VStack, and I'm going to go up here. I'm going to collapse the VStack for a sec, and I'm going to put underneath this VStack, a background. And then inside the background, I'm going to put a color, and we'll use surf for this. And now the whole background is that color. If I had done this with padding afterwards, notice what happens. The padding pushes the background inward a little bit, and you've got a margin that doesn't have the…
Contents
-
-
-
-
-
(Locked)
Presenting views2m 19s
-
(Locked)
Space modifiers2m 54s
-
(Locked)
Shape modifiers3m 54s
-
(Locked)
Text modifiers8m
-
(Locked)
Color modifiers6m 4s
-
(Locked)
Basic backgrounds8m 29s
-
(Locked)
Materials and shadows7m 17s
-
Scale modifiers4m 42s
-
(Locked)
Size modifiers5m 25s
-
(Locked)
Clean up joined views6m 9s
-
(Locked)
Challenge: Clean up OrderView1m 28s
-
(Locked)
Solution: Clean up OrderView8m 36s
-
(Locked)
-
-
-
-
-
-
-
-
-
-
-
-
-