Reputation: 4969
Is there any way to convert a UIColor to a string? For example,
var color = UIColor.purpleColor()
var colorString : String = //Purple
If you can help me it would be greatly appreciated. Thanks
Upvotes: 1
Views: 112
Reputation: 23882
You can get color description
var color = UIColor.purpleColor()
var colorString : String = color.description
println(colorString)
var cgColorRef = UIColor.purpleColor().CGColor
var strColor = CIColor(CGColor: cgColorRef).stringRepresentation()
println(strColor)
Reference from : How to convert UIColor value to a named color string?
Upvotes: 2