title: Why does only the built-in UIColors work here?
body: <p>Having failed miserably at further attempts to solve <a href="https://stackoverflow.com/questions/54934109/scnaction-to-change-color-of-node-works-once-then-never-again">this question</a> on my own, I'm trying something I thought would work for certain:</p>
  
  <pre><code>func switchColor(data:UInt32){
          switch data {
          case 1..&lt;200:
              backgroundGeometry.firstMaterial?.diffuse.contents =
                  UIColor(red: CGFloat(242), green: CGFloat(90), blue: CGFloat(90), alpha: 1.0)
          case 200..&lt;400:
              backgroundGeometry.firstMaterial?.diffuse.contents =
                  UIColor(red: CGFloat(252), green: CGFloat(162), blue: CGFloat(115), alpha: 1.0)
          case 400..&lt;600:
              backgroundGeometry.firstMaterial?.diffuse.contents =
                  UIColor(red: CGFloat(244), green: CGFloat(235), blue: CGFloat(99), alpha: 1.0)
          case 600..&lt;800:
              backgroundGeometry.firstMaterial?.diffuse.contents =
                  UIColor(red: CGFloat(110), green: CGFloat(195), blue: CGFloat(175), alpha: 1.0)
          case 800..&lt;1000:
              backgroundGeometry.firstMaterial?.diffuse.contents =
                  UIColor(red: CGFloat(91), green: CGFloat(118), blue: CGFloat(211), alpha: 1.0)
          default:
              backgroundGeometry.firstMaterial?.diffuse.contents = UIColor.green
          }
      }
  </code></pre>
  
  <p>All the non-default cases turns the node white.
  The default case does turn it green - and within each case, statements like UIColor.red, UIColor.blue work fine as well.</p>
  
  <p>So why the heck doesn't the above statements work?</p>
  
  <p>Hope you can help, I'm completely at a loss here :(</p>
  
  <p>Edit: Thanks for the swift and not least correct answers! All accepted and upvoted, but I'm too much of a newbie for it to display. Thanks! :)</p>