From the course: SwiftUI Essential Training

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Add view

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…

Contents