title: having trouble using UIViewControllerAnimatedTransitioning with swift 3
body: <p>I'm trying to follow <a href="https://www.raywenderlich.com/86521/how-to-make-a-view-controller-transition-animation-like-in-the-ping-app">this</a> tutorial on building a custom transition. Once I got to a custom to the part that involves UIViewControllerAnimatedTransitioning, I began having errors. (I"m still new to swift, so it's taken a lot of effort with nothing to show so far).</p>
  
  <p>I keep getting 2 errors. 1 - </p>
  
  <blockquote>
    <p>Cannot assign value of type 'CircleTransitionAnimator' to type 'CAAnimationDelegate?' </p>
  </blockquote>
  
  <p>2 - </p>
  
  <blockquote>
    <p>Method does not override any method from its superclass</p>
  </blockquote>
  
  <p>I'm guessing that the issue is related to UIViewControllerAnimatedTransitioning</p>
  
  <pre><code>class CircleTransitionAnimator: NSObject, UIViewControllerAnimatedTransitioning {
  
  func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -&gt; TimeInterval {
      return 0.5
  }
  
  weak var transitionContext: UIViewControllerContextTransitioning?
  
  func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
  
      self.transitionContext = transitionContext
  
      var containerView = transitionContext.containerView()
      var fromViewController = transitionContext.viewController(forKey: UITransitionContextFromViewControllerKey) as! ViewController
      var toViewController = transitionContext.viewController(forKey: UITransitionContextToViewControllerKey) as! ViewController
      var button = fromViewController.button
  
      containerView.addSubview(toViewController.view)
  
      var circleMaskPathInitial = UIBezierPath(ovalIn: (button?.frame)!)
      var extremePoint = CGPoint(x: (button?.center.x)! - 0, y: (button?.center.y)! - toViewController.view.bounds.height)
      var radius = sqrt((extremePoint.x*extremePoint.x) + (extremePoint.y*extremePoint.y))
      var circleMaskPathFinal = UIBezierPath(ovalIn: (button?.frame)!.insetBy(dx: -radius, dy: -radius))
  
      var maskLayer = CAShapeLayer()
      maskLayer.path = circleMaskPathFinal.cgPath
      toViewController.view.layer.mask = maskLayer
  
      var maskLayerAnimation = CABasicAnimation(keyPath: "path")
      maskLayerAnimation.fromValue = circleMaskPathInitial.cgPath
      maskLayerAnimation.toValue = circleMaskPathFinal.cgPath
      maskLayerAnimation.duration = self.transitionDuration(using: transitionContext)
      maskLayerAnimation.delegate = self
      maskLayer.add(maskLayerAnimation, forKey: "path")
  
  
  }
  
  override func animationDidStop(anim: CAAnimation!, finished flag: Bool) {
      self.transitionContext?.completeTransition(!self.transitionContext!.transitionWasCancelled())
      self.transitionContext?.viewController(forKey: UITransitionContextFromViewControllerKey)?.view.layer.mask = nil
  }
  
  }
  </code></pre>