title: CGColor not defined for the UIColor, need to first convert colorspace. Swift 2, Xcode 7
body: <p>I was trying to change the color of my app´s buttons by creating the color using sliders to select the values of Red, Green, Blue and Alpha. So I created an variable which held the color created by the user. </p>
  
  <p>ViewController is where the buttons are.
  ChangeColors is the RGB Sliders System.</p>
  
  <pre><code>import UIKit
  
  import Foundation
  
  var buttonColor = UIColor()
  
  class ViewController: UIViewController {
  
  @IBOutlet var tools: UIButton!
  
  @IBOutlet var custom: UIButton!
  
  @IBOutlet var support: UIButton!
  
  @IBOutlet var donate: UIButton!
  
  
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      tools.backgroundColor = buttonColor
      custom.backgroundColor = buttonColor
      support.backgroundColor = buttonColor
      donate.backgroundColor = buttonColor
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  }
  </code></pre>
  
  <p>The second is the code of te RGB Slider System.</p>
  
  <pre><code>import Foundation
  
  import UIKit
  
  class ChangeColors: UIViewController {
  
  @IBOutlet var Red: UISlider!
  
  @IBOutlet var Green: UISlider!
  
  @IBOutlet var Blue: UISlider!
  
  @IBOutlet var Alpha: UISlider!
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  
  @IBAction func preview(sender: AnyObject) {
  
      let rVal = CGFloat(Red.value)
      let gVal = CGFloat(Green.value)
      let bVal = CGFloat(Blue.value)
      let aVal = CGFloat(Alpha.value)
  
      self.view.backgroundColor = UIColor(red: rVal, green: gVal, blue: bVal, alpha: aVal)
  }
  
  @IBAction func change(sender: AnyObject) {
  
      let rVal = CGFloat(Red.value)
      let gVal = CGFloat(Green.value)
      let bVal = CGFloat(Blue.value)
      let aVal = CGFloat(Alpha.value)
      let color = UIColor(red: rVal, green: gVal, blue: bVal, alpha: aVal)
  
      buttonColor = color
  
  }
  
  }
  </code></pre>
  
  <p>But the app crashes as soon as it open and get the following error:</p>
  
  <p>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -CGColor not defined for the UIColor ; need to first convert colorspace.</p>
  
  <p>I really need help. Thank You.</p>