From the course: Complete Guide to SwiftUI
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Toggles and steppers
From the course: Complete Guide to SwiftUI
Toggles and steppers
- [Instructor] We've learned the basics of data and how to present information. Now it's time to get users to interact with the system using controls. Controls use binding variables to read and write values to the control. I'll start by looking at two simple controls, then get more complicated, but we're going to do this in a new view. So let's make a new SwiftUI view. So let's go into our code here and do a Command + N, do a SwiftUI View, make sure all of our things are right, which they are. And then I'm going to go up here and put in OrderItemView, and create that. I'm going to make a couple of variables here that we're going to be using. So we're going to start with a Binding, orderItem, and that will be of OrderItem. We'll do a State, which will be quantity, and another State, which will be for doubleIngredient. We will make that a bool that's false. Okay, so we've got this now in place. And I forgot a var up there, so let's put that in. And then, of course, we've got our…
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)
-
-
-
-
-
-
-
-
-
-