I am working on an iPhone application which uses various colors. When user selects the particular color button I set drawing color accordingly. I am getting the color for so
Pragmatic approach with Swift.
extension UIColor {
convenience init(rgbColorCodeRed red: Int, green: Int, blue: Int, alpha: CGFloat) {
let redPart: CGFloat = CGFloat(red) / 255
let greenPart: CGFloat = CGFloat(green) / 255
let bluePart: CGFloat = CGFloat(blue) / 255
self.init(red: redPart, green: greenPart, blue: bluePart, alpha: alpha)
}
}