[Swift]UIColorからrgb取得

UIColorからrgb値取得

func getColorTupleByUIColor(color:UIColor) -> (r:CGFloat,g:CGFloat,b:CGFloat){
    var r:CGFloat = 0
    var g:CGFloat = 0
    var b:CGFloat = 0
    var a:CGFloat = 0
    color.getRed(&r, green: &g, blue: &b, alpha: &a)
    return (r: r, g: g, b: b)
}