From the course: SwiftUI Essential Training

Schalten Sie den kompletten Kurs noch heute frei

Join today to access over 23,300 courses taught by industry experts.

Challenge: Add a button

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 MenuItemView. 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 placemarker 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.

Inhalt