title: Extract RGB Values From UIColor
body: <p>I have seen people do this in objective-c, but I am having trouble with this in swift. I have gotten the color of a pixel from a picture, but now I need to take the individual red, green, and blue values. Here is what I have (h, w, and rgb are integers and image.getPixelColor(CGPoint) returns a UIColor):</p>
  
  <pre><code> xArry[h][w][rgb] = image.getPixelColor(CGPoint(x: w, y: h))
  </code></pre>
  
  <p>How do I change this UIColor into the red, green, and blue values? Thanks!</p>