Skip to content

Instantly share code, notes, and snippets.

@henngelm
Created February 17, 2018 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henngelm/8b93478b8d71a7ccdd3e8c65b9ba561a to your computer and use it in GitHub Desktop.
Save henngelm/8b93478b8d71a7ccdd3e8c65b9ba561a to your computer and use it in GitHub Desktop.
Generating random UIColor 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)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment