title: Use slider to pick a color for view's background
body: <p>I'm trying to write a function that should help me pick rainbow color from slider and set it on the view background. </p>
  
  <p>Slider should have all rainbow colors presented, and as user slide it, view background changes according to it.</p>
  
  <p>I did something like this, but it is showing only one color:</p>
  
  <p>@IBOutlet var slider: UISlider!
      @IBAction func changeColor(sender: AnyObject) {</p>
  
  <pre><code>    var increment:CGFloat = 0.05
      var counter = slider.value
  
      for counter = 1; counter&lt;=20; counter++ {
          for var hue:CGFloat=0.0; hue &lt; 1.0; hue+=increment {
  
                  var color = UIColor(hue: hue, saturation: 1.0, brightness: 1.0, alpha: 1.0)
                  self.view.backgroundColor = color
          }
      }
  }
  </code></pre>