From the course: SwiftUI Essential Training
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Add view
- [Instructor] So far we've been working with the one content view in SwiftUI. However, good SwiftUI should be small multiple files each doing a smaller part of the full hierarchy. You'll be adding a lot of views to projects. So let's go through how to add a view to an app. There's two primary ways to add views to an app. In Xcode, you can use the SwiftUI template. Just go to File, New, File and you'll see under user interface SwiftUI view and you can go ahead and hit Next. And then make sure you've got the right group and the right targets and the right location for your file. And then just change the name here. So I'm just going to make this one order view and then just create it. And that creates a new file here called order view. The second way you can use both in Xcode and if you're using the Swift Playgrounds app, instead of a template, you create a blank Swift file. So I'll just do the same thing again, File, New…
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.
Contents
-
-
-
-
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
-
(Locked)
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
-
-
-
-
-
-
-
-