gpt4 book ai didi

ios - Swift 3.0 中的预期表达式错误

转载 作者:行者123 更新时间:2023-11-30 13:03:52 24 4
gpt4 key购买 nike

我对这段代码有疑问:

private static func replaceAnimationMethods() {
//replace actionForLayer...
method_exchangeImplementations(
class_getInstanceMethod(self, #selector(UIView.actionForLayer(_:forKey:))),
class_getInstanceMethod(self, #selector(UIView.EA_actionForLayer(_:forKey:))))

//replace animateWithDuration...
method_exchangeImplementations(
class_getClassMethod(self, #selector(UIView.animateWithDuration(_:animations:))),
class_getClassMethod(self, #selector(UIView.EA_animateWithDuration(_:animations:))))
method_exchangeImplementations(
class_getClassMethod(self, #selector(UIView.animateWithDuration(_:animations:completion:))),
class_getClassMethod(self, #selector(UIView.EA_animateWithDuration(_:animations:completion:))))
method_exchangeImplementations(
class_getClassMethod(self, #selector(UIView.animateWithDuration(_:delay:options:animations:completion:))),
class_getClassMethod(self, #selector(UIView.EA_animateWithDuration(_:delay:options:animations:completion:))))
method_exchangeImplementations(
class_getClassMethod(self, #selector(UIView.animateWithDuration(_:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:))),
class_getClassMethod(self, #selector(UIView.EA_animateWithDuration(_:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:))))

}

我正在尝试迁移到 Swift 3.0。

对于:

class_getClassMethod(self, #selector(UIView.animate(withDuration:animations:)(_:animations:))),

我收到错误表达式列表中的预期表达式

对于:

class_getClassMethod(self, #selector(UIView.animate(withDuration:animations:completion:)(_:animations:completion:))),

我收到错误预期的“,”分隔符

想知道如何解决这个问题。任何指示将不胜感激。

最佳答案

您是否尝试过像下面的语法。

class_getClassMethod(self, #selector(UIView.animate(withDuration:animations:)))
class_getClassMethod(self, #selector(UIView.animate(withDuration:animations:completion:)))

关于ios - Swift 3.0 中的预期表达式错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39613610/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com