Learn about one of the fundamental techniques in iOS development: connecting views like buttons or labels from your storyboard to outlets in your code.
I am following along with your BullsEye tutorial and I currently am at @IBOutlet weak var slider: UISlider! , I linked the slider to reference outlet slider when I change the value under Attributes inspector, build and run the project the slide is at the correct location but the Hit me! alert is still showing 50.
Bug Resolved. Forgot to add
let roundValue = slider.value.rounded()
currentValue = Int(roundedValue)
This is really a great tutorial series overall but what surprises me is that Ray does not make use of the Assistant Editor and the control-click-drag functionality to auto-create code in the VC swift file.
It may also elude beginners to directly see the link between VC and the swift file. Only later, when adding an about screen, the relation between the AboutVC class defined in the swift file and the class of the AboutVC in the StoryBoard becomes clear because it needs to be defined in the StoryBoard. Maybe add a slide with the whole MVC concept as well?
Hi. Now that we’ve created an @IBOutlet for the slider, do we need the sliderMoved function anymore? Could we simply get the slider’s value from within showAlert as that’s the only time that Bull’s Eye is really interested in its value, right?