From the course: iOS 17 Development Essential Training
Unlock this course with a free trial
Join today to access over 24,500 courses taught by industry experts.
Creating horizontal and vertical layouts
From the course: iOS 17 Development Essential Training
Creating horizontal and vertical layouts
- [Instructor] Now let's go a little bit deeper into working with stacks in SwiftUI. Before we do that, I want to point out that sometimes when you open up the exercise files, you may see that the preview was paused in the canvas. To restore it, simply click the refresh button, and in a second or two, it should appear again. I'll just adjust the user interface to go back to where it was. And let's look at stacks. So inside of our VStack, we've looked at how we have an image above a text view. We can also use something called HStacks, or horizontal stacks, to align items horizontally. Underneath my VStack declaration, on a new line, I'm going to create an HStack. So I'll type out HStack and use the code hinting to complete it. Add an open curly brace, and then below the text view, I'm going to add a closed curly brace. So notice that the code indented within that as well. And look at how the UI has updated in the preview.…
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.