Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Vending Machine App in Swift 2.0 Using the Vending Machine Updating the Quantity

Keli'i Martin
Keli'i Martin
8,227 Points

Small usability issue with the UIStepper

Just wanted to point out a small usability issue that we are left with when calling the reset() function. When we change the quantity using the stepper and then tap on a different item, the quantity label correctly changes back to 1, but the stepper's value is still set to whatever it was at before we called reset(). This is evident by the fact that both the - and + are available to tap. In fact, if you click on the - after reset() is called, it will step backwards from wherever we left off.

To fix this, we need to set the stepper's value back to 1. However, as the code currently sits, we are unable to do this, because we did not create an outlet for the stepper in our view controller. If we create that outlet and then add a line in the reset() function to set the stepper's value back to 1, the issue is solved.

Hope this was informative! Carry on!!

cc Pasan Premaratne

Ben Shockley
Ben Shockley
6,094 Points

I was just noticing that towards the end of the video and came here to see if anyone else had as well. That's the same solution I was thinking of doing.

mahi
mahi
7,137 Points

thatIsWhatIDId

1 Answer

Keli'i Martin
Keli'i Martin
8,227 Points

This post didn't necessarily need an answer (there wasn't a question), but I'm making this the answer and marking it best so as to stop getting reminded that I need to select a best answer... :)