From the course: Building Your First iOS 17 App
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
HStacks in SwiftUI
From the course: Building Your First iOS 17 App
HStacks in SwiftUI
- [Instructor] Now we're going to continue to build out our user interface by putting stacks within stacks. So our outer element is a VStack. We can actually embed these objects inside of an HStack that lives within a VStack. Let's take a look at how that works and why you might want to do it. One way to embed it other than writing the code manually, is to right click the block of code and then choose embed an HStack. Now what that did is it just embedded the image, but I can simply cut and paste this tip calculator text with command X and command V respectively, and then I'll tab in that foreground style to make it look a little prettier. And now we have this tip calculator and it's horizontal and it looks pretty much the same as if I were to change the outer VStack to an HStack. But what I can do now is just copy and paste this block. That's command C, command V, and then I'm going to delete this image. And now we have…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.