-5

I Cloned bacon testing application on github in this application they add 3 UIColors with value in array so I need to change that UIColor tips for UI Image type any one please help meenter image description here

1 Answers1

-1

You can use this extension:

   extension UIImageView {
      func setImageColor(color: UIColor) {
        let templateImage = self.image?.withRenderingMode(UIImage.RenderingMode.alwaysTemplate)
        self.image = templateImage
        self.tintColor = color
      }
    }

let imageView = UIImageView(image: UIImage(named: "your_image_name"))
imageView.setImageColor(color: UIColor.purple)

Reference link: How can I color a UIImage in Swift?

Ali Ihsan URAL
  • 1,894
  • 1
  • 20
  • 43