From the course: Complete Guide to SwiftUI

Unlock this course with a free trial

Join today to access over 24,600 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-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