title: changing the tint of the image in swift
body: <p>I am new to swift and trying to achieve this essentially, 
  This image to 
  <a href="https://i.stack.imgur.com/QjBT8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QjBT8.png" alt="enter image description here"></a></p>
  
  <p>This image -></p>
  
  <p><a href="https://i.stack.imgur.com/bSt5T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bSt5T.png" alt="enter image description here"></a></p>
  
  <p>I am using this code <a href="https://gist.github.com/alexruperez/90f44545b57c25b977c4" rel="nofollow noreferrer">from here</a> to change the tint on image but do not get the desired output</p>
  
  <pre><code>func tint(image: UIImage, color: UIColor) -&gt; UIImage
  {
      let ciImage = CIImage(image: image)
      let filter = CIFilter(name: "CIMultiplyCompositing")
  
      let colorFilter = CIFilter(name: "CIConstantColorGenerator")
      let ciColor = CIColor(color: color)
      colorFilter.setValue(ciColor, forKey: kCIInputColorKey)
      let colorImage = colorFilter.outputImage
  
      filter.setValue(colorImage, forKey: kCIInputImageKey)
      filter.setValue(ciImage, forKey: kCIInputBackgroundImageKey)
  
      return UIImage(CIImage: filter.outputImage)!
  }
  </code></pre>
  
  <p>If this is a noob question, apologies. I was able to do this easily in javascript but not in swift. </p>