I am trying to compare colors but I cannot use the isEqual
method because I am trying to compare the color of the background of a UICollectionViewCell
.
What is the correct way to compare colors in this situation?
if(cell!.layer.backgroundColor! == UIColor.redColor().CGColor)
{
cell?.layer.backgroundColor = UIColor.redColor().CGColor
}
Try CGColorEqualToColor(_ color1: CGColor!, _ color2: CGColor!) -> Bool
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With