Your First Swift App: Lesson 15 question

Hi, I suspect this isn’t the right place to post my question, but I’m new to the site and I haven’t figured out how else to raise this problem. So I followed the lesson to the best of my abilities and when I initiate the app, the Hit Me! button produces a message that the initial reading is “0” as stated in the initial variable declaration, instead of reading the slider. My code is included below:

class ViewController: UIViewController {

var currentValue: Int = 0
@IBOutlet weak var slider: UISlider!


override func viewDidLoad() {
    super.viewDidLoad()

I believe I connected it correctly, so I’m not sure how I got this wrong. Help appreciated, thank you,
Bill

Please add this line of code inside your view controller’s viewDidLoad() method in order to update the currentValue variable’s value to the slider’s one:

currentValue = lroundf(slider.value)

Please also ask any other questions regarding this video tutorial in its corresponding topic thread over here:

Thank you! :]

This topic was automatically closed after 166 days. New replies are no longer allowed.