title: Adding CAShapeLayer to UIButton Not Working
body: <p>I am working on a Swift project and creating a circle around a UIButton, using CAShapeLayer and creating a circular UIBezeir path.The problem is that if I add this CAShapLayer as a sublayer to UIbutton,It does not work. However adding this sublayer on UiView creates the circle.</p>
  
  <p>Below is my code.</p>
  
  <pre><code>let ovalPath = UIBezierPath(arcCenter: lockButton.center, radius:
          CGFloat(lockButton.frame.size.width/2), startAngle: CGFloat(startAngle), endAngle: CGFloat(sentAngel), clockwise: true)
      UIColor.grayColor().setFill()
      ovalPath.fill()
  
      let circleLayer = CAShapeLayer()
      circleLayer.path = ovalPath.CGPath
  
      view.layer.addSublayer(circleLayer)
      circleLayer.strokeColor = UIColor.blueColor().CGColor
      circleLayer.fillColor = UIColor.clearColor().CGColor
      circleLayer.lineWidth = 10.0
  
  
  
  
  
      let animation = CABasicAnimation(keyPath: "strokeEnd")
  
      // Set the animation duration appropriately
      animation.duration = 0.5
  
      // Animate from 0 (no circle) to 1 (full circle)
      animation.fromValue = 0
      animation.toValue = 1
  
  
      // Do a linear animation (i.e. the speed of the animation stays the same)
      animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
  
      // Set the circleLayer's strokeEnd property to 1.0 now so that it's the
      // right value when the animation ends.
      circleLayer.strokeEnd = 3.0
  
      // Do the actual animation
      circleLayer.addAnimation(animation, forKey: "animateCircle")
  </code></pre>
  
  <p>Can anyone suggest me, if we can add CAShapeLayer to UIButton?
  Thanks</p>