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.
Challenge: Add a button
From the course: Complete Guide to SwiftUI
Challenge: Add a button
(upbeat music) - [Instructor] Okay, it's time for another challenge. You've seen one button, now let's add another. So we're going to add a button-to-menu item view. And you can see it there, it's going to be a red button with white lettering, and it'll have a price of 12,99, since we're going to put a place marker for the moment, and I'll have a shadow as well. And what I want you to do is be able to toggle between cart.badge.plus and cart.full.badge.plus. So that cart will fill itself up if you have one item or more. And in order to do that, use the variable addedItem. Okay, give that a try, see what you can come up with.
Contents
-
-
-
-
-
- (Locked) MVC vs. MVVM4m 19s
- (Locked) State variables and buttons3m 57s
- (Locked) Challenge: Add a button45s
- (Locked) Solution: Add a button3m 50s
- (Locked) Use Binding variables10m 10s
- (Locked) The Identifiable protocol5m 13s
- (Locked) Add a model to root views6m 47s
- Populating collections with List4m 45s
- (Locked) Selection and binding variables6m 29s
- (Locked)
-
-
-
-
-
-
-
-
-
-
-
-