Skip to content

Instantly share code, notes, and snippets.

@haldun
Created March 19, 2015 17:11
Show Gist options
  • Save haldun/48b0c7bd60cf2de4ff44 to your computer and use it in GitHub Desktop.
Save haldun/48b0c7bd60cf2de4ff44 to your computer and use it in GitHub Desktop.
Random extension for UIColor
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