Created
February 17, 2018 04:59
-
-
Save henngelm/8b93478b8d71a7ccdd3e8c65b9ba561a to your computer and use it in GitHub Desktop.
Generating random UIColor in Swift
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
// 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