[Swift 1] Day 17 - Code Exercise Solution


Please share your code or answers with your classmates for the Day 17 Code Exercise and related Notebook Activity questions.

Share code using


Only use code or watch video solution if you’re unsure how to solve or get stuck. It’s better to attempt writing the code first.


Here is my code:

And here is my code broken down:

Not much different from your code Paul.
I think it was very useful to make this only in code even though I think I’d rather use the
GUI for stuff like that too :slight_smile:


Here is my homework. [Gist files][1]

[1]: https://gist.github.com/sashalondon/3d34d7f1d3aa9d19308e


Here is my code

I use UIPickerView instead of UISlider. When Running test it seem the code calculate slower than using UISlider, I don’t know maybe it came from my code programatic or from UIPickerView, It look like UISlider more appropriate to use in calculation.

Hi, Paul. I love the way that you instruct us, you make it more easy to understand the lesson and lead us to other useful links. Especially in UIView lesson it make me more clear about UIView, many thanks for that Paul :slight_smile:

I try Xcode 7 beta and it changed in some when you code like:

UIView.animateWithDuration (1.5, delay: 1.0, usingSpringWithDamping: 1.0, initialSpringVelocity: 0.0, options: [], animations: {            
       self.sliderBarView.frame.origin.y = sliderBarEndY
 }, completion: nil)

at option:nil changed to option: [] so code can be run. When you’re just the beginner, it hard to find where the error is and I didn’t found about this descriptions in Xcode documentations.