Sunday, 24 July 2016

UIColor extension random color Swift

extension UIColor {
    class func randomColor() -> UIColor {
        let hueAmount = CGFloat(arc4random() % 100) / 100
        let saturationAmount = CGFloat(arc4random() % 100) / 100
        let brightnessAmount = CGFloat(arc4random() % 100) / 100
        return UIColor(hue: hueAmount, saturation: saturationAmount, brightness: brightnessAmount, alpha: 1.0)
    }

}