From the course: Make SwiftUI Playgrounds Applications
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
More on the view hierarchy - Swift Tutorial
From the course: Make SwiftUI Playgrounds Applications
More on the view hierarchy
- [Steven] We've begun to explore how models and views are put together. In the previous videos, I looked at the model more than the view. This time I want to look more at the view hierarchy. The pizzas on our menu have an id number. The id number, among other things, will identify images of the pizzas. We don't have the correct images yet, but we can set up that id number. So let's use the id to take a tour of the view hierarchy. A view hierarchy is the way we connect the views we've made in SwiftUI together. On top we have ContentView, which heads down to MenuItemView. MenuItemView either displays HMenuItemView or VMenuItemView. Currently we are passing a String in ContentView to MenuItemView to the H or VMenuItemViews. It's only one property of the pizza. I'd have to add a lot of parameters to pass more than this if I wanted, say, a name, a description, a price, and an id. By passing the entire MenuItem struct…
Contents
-
-
-
(Locked)
More on the view hierarchy12m 11s
-
(Locked)
Formatted numbers8m 23s
-
(Locked)
Computed properties6m 7s
-
(Locked)
Arrays9m 54s
-
(Locked)
For loops9m 42s
-
(Locked)
Use ForEach in SwiftUI8m 32s
-
(Locked)
Protocols, Hashable, and Identifiable3m 56s
-
(Locked)
Importing models and assets8m 27s
-
(Locked)
Adapting models8m 43s
-
(Locked)
Scroll view and list6m 34s
-
Work with @State and toggle buttons8m 43s
-
(Locked)
Make Button arrays7m 13s
-
(Locked)
Work with @Binding5m 59s
-
(Locked)
Enumeration types8m 45s
-
(Locked)
Selection from lists4m 21s
-
(Locked)
Optional values6m 10s
-
(Locked)
-