Group Group Group Group Group Group Group Group Group

Part 4: Slider and Labels


#1

Welcome, this is a thread for collaboration, questions, and feedback on Part 4 of the iOS Apprentice Email course.

"Your First Bug" Challenge Solution

The problem is that if you don’t move the slider, the sliderMoved() message is never sent and you never put the slider’s value into the currentValue variable.

The default value for the currentValue variable is 0, and that is what you are seeing here.

➤ To fix this bug, change the declaration of currentValue to:

var currentValue: Int = 50

Now the starting value of currentValue is 50, which should be the same value as the slider’s initial position.

➤ Run the app again and verify that the bug is fixed.

Note that there is also another (better) way to fix this problem, that you will learn about in the next part of this course. :]

Downloads

Here’s a download for the project to use at the beginning of this email:

BullsEye-part3-final-v2.zip (26.8 KB)

Here’s a download for the project where it stands at the end of this email:

BullsEye-part4-final-v2.zip (27.6 KB)