CABasicAnimation не работает в swift 3

#ios #swift #swift3 #cabasicanimation

#iOS #swift #swift3 #cabasicanimation

Вопрос:

    let path = CGMutablePath()


    path.move(to: CGPoint(x:0.0, y:10.5))
    path.addLine(to: CGPoint(x: (self.frame.width/2), y:20.5))



    let pathInit = CGMutablePath()

    pathInit.move(to: CGPoint(x: 0, y:0))
    pathInit.addLine(to: CGPoint(x: self.frame.width/2, y: 0))




    // update the path property on the mask layer, using a CATransaction to prevent an implicit animation
    let mask = CAShapeLayer()

    mask.path = pathInit


    let maskLayer: CAShapeLayer = CAShapeLayer()
    maskLayer.path = pathInit
    self.layer.mask = maskLayer
    let anim = CABasicAnimation(keyPath: "path")
    anim.fromValue = maskLayer.path
    anim.toValue = path
    anim.duration = 0.25
    anim.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
    maskLayer.add(anim, forKey: nil)
    CATransaction.begin()
    CATransaction.setDisableActions(true)
    maskLayer.path = path
    CATransaction.commit()
  

После перехода на swift 3 эта функция не работает, я думаю, это потому, что CABasicAnimation или CGMutablePath

пожалуйста, помогите,