static func animate(_ duration: TimeInterval,
animations: (() -> Void)!,
delay: TimeInterval = 0,
options: UIViewAnimationOptions = [],
withComplection completion: (() -> Void)! = {}) {
UIView.animate(
withDuration: duration,
delay: delay,
options: options,
animations: {
animations()
}, completion: { finished in
completion()
})
}
Run Code Online (Sandbox Code Playgroud)
在我的swift文件中使用上面的类并创建如下所示的函数
SPAnimation.animate(durationScalingRootView,
animations: {
rootViewController.view.transform = CGAffineTransform.identity
},
delay: delayScalingRootView,
options: UIViewAnimationOptions.curveEaseOut,
withComplection: {
finished in
//rootViewController.view.layer.mask = nil
})
Run Code Online (Sandbox Code Playgroud)
得到此错误
上下文闭包类型'() - > Void'需要0个参数,但在闭包体中使用了1
swift ×1