小编Gow*_*raj的帖子

上下文闭包类型'() - > Void'需要0个参数,但在闭包体错误显示中使用了1

   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

3
推荐指数
1
解决办法
5560
查看次数

标签 统计

swift ×1