title: add gradient to UILabel in a collectionView cell - swift
body: <p>I'm trying to add gradient to an UILabel in a collectionViewCell. To add gradient I'm using this function:</p>
  
  <pre><code>extension UIView
  {
       func gradient(colors: [Any], startPoint: CGPoint, endPoint: CGPoint, opacity: Float, location: [NSNumber]?) {
           let gradientLayer = CAGradientLayer()
           gradientLayer.frame = bounds
           gradientLayer.colors = colors
           gradientLayer.startPoint = startPoint
           gradientLayer.endPoint = endPoint
           gradientLayer.opacity = opacity
           gradientLayer.locations = location
           layer.addSublayer(gradientLayer)
       }
  }
  </code></pre>
  
  <p>and in my collectionViewCell : </p>
  
  <pre><code>@IBOutlet weak var discount: UILabel!
  
  override func awakeFromNib() {
      super.awakeFromNib()
      discount.gradient(colors: [green,blue], startPoint: CGPoint(x: 0.0, y: 0.5), endPoint: CGPoint(x: 1.0, y: 0.5), opacity: 1, location: [0.5,0.5])
  }
  </code></pre>
  
  <p>But it's not showing anything. Adding shadow works fine but adding gradient not showing anything. Why is that happen?</p>