iOS开发之函数调用

定义函数

func animation1(layerParam: CAShapeLayer){
        let animation = CABasicAnimation(keyPath: "strokeEnd")
        animation.fromValue = 0
        animation.toValue = 1
        animation.duration = 2.0
        layerParam.addAnimation(animation, forKey: "")
    }

 layerParam:CAShapeLayer为需要传入参数,调用时⬇️

self.animation1(layer)

 注意格式,layer为传入animation1的参数,在这里是一个CAShapeLayer

你可能感兴趣的:(iOS开发之函数调用)