Created
March 19, 2015 17:11
-
-
Save haldun/48b0c7bd60cf2de4ff44 to your computer and use it in GitHub Desktop.
Random extension for UIColor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIColor { | |
class func random() -> UIColor { | |
let r: CGFloat = CGFloat(drand48()) | |
let g: CGFloat = CGFloat(drand48()) | |
let b: CGFloat = CGFloat(drand48()) | |
return UIColor(red: r, green: g, blue: b, alpha: 1) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment