April 2020
Beginner
316 pages
8h 20m
English
In this section, we'll cover nesting views within our main body view and learn when they are used. Believe it or not, we touched on nesting in the previous section. Remember when we added a List wrapper around our multiple Text boxes? That was nesting.
Let's have a look at some more examples of nesting in SwiftUI. First, we'll start off with our code from the previous section, which incorporated a List:
struct ContentView: View { var body: some View { List { Text("Hello World") .bold() .foregroundColor(.blue) .blur(radius: 1, opaque: false) } }}
Next, we're going to add a Navigation view to our app since we want this to control the whole content of our app. To achieve this, we simply wrap NavigationView { } around the existing ...
Read now
Unlock full access