Skip to content

Instantly share code, notes, and snippets.

@skreutzberger
Created August 12, 2015 14:38
Show Gist options
  • Save skreutzberger/32be80e2ebef71dfb793 to your computer and use it in GitHub Desktop.
Save skreutzberger/32be80e2ebef71dfb793 to your computer and use it in GitHub Desktop.
generate random color in Swift
// returns a random color
func randomColor() -> UIColor{
let red = CGFloat(drand48())
let green = CGFloat(drand48())
let blue = CGFloat(drand48())
return UIColor(red: red, green: green, blue: blue, alpha: 1.0)
}
@commando24
Copy link

@ddytert yeah it will be easy to use that using extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment