title: UIColor code in a variable in swift
body: <p>I want to set the background color of view through a parameter so that when 1 want to change it I can change it. The value of the parameter is coming from database. My current code is like follows:</p>
  
  <pre><code>loadingView.backgroundColor = UIColor(red:0.99, green:0.75, blue:0.14, alpha:1.0) 
  </code></pre>
  
  <p>I want to change the above code as follows:</p>
  
  <pre><code>loadingView.backgroundColor = UIColor(red:a, green:b, blue:c, alpha:d)
  
                                   or
  
  loadingView.backgroundColor = UIColor(hex) 
  </code></pre>
  
  <p>Where a, b, c, d and hex are variables and all of these have a value.</p>