From the course: Complete Guide to SwiftUI
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Solution: Add a grid view to the app
From the course: Complete Guide to SwiftUI
Solution: Add a grid view to the app
- [Instructor] Time for the solution for round two, and we're going to start in MenuGridView here with a few changes. So we've got a selectedItem here. And one of the things I do when you notice that I have private for favorites but I don't for var, that's usually an indicator to me that I'm going to be changing this to binding at some point and I'm going to be messing with it a lot later in converting one to the other. But I don't want to use a binding to start 'cause it makes it harder to take care of problems, particularly with the way of previews and constants. And we're now going to have to change this to put in the selected item that I didn't need before, and that's going to be a constant and that makes it hard to test things. So I'm just going to put the constant in here and that'll be noMenuItem. I've got something that's a little redundant here. I've got this text here, and I'm going to just comment that out…
Contents
-
-
-
-
-
-
-
- (Locked) Toggles and steppers6m 8s
- (Locked) Pickers6m 10s
- (Locked) Moving data in pickers5m 54s
- Text input7m 1s
- (Locked) Lazy grids6m 37s
- (Locked) Tap gestures3m 1s
- (Locked) Reacting to changes5m 59s
- (Locked) Challenge: Favorites grid1m 46s
- (Locked) Solution: Favorites grid8m 55s
- (Locked) Challenge: Add a grid view to the app40s
- (Locked) Solution: Add a grid view to the app6m 10s
- (Locked)
-
-
-
-
-
-
-
-
-
-