I am using SideMenuController pod in Xcode 9, Swift 4. Trying to get the side panel animations working. Cant work out why its throwing this error. Thanks in advance if you can help!
我在Xcode 9,Swift 4中使用SideMenuController pod。试图让侧面板动画工作。无法解决为什么抛出这个错误。如果您能提供帮助,请提前致谢!
UIView.panelAnimation( duration, animations: {
self.centerPanel.frame = centerPanelFrame
self.set(statusUnderlayAlpha: hidden ? 0 : 1)
}) { _ in // THROWS ERROR - CANNOT CONVERT VALUE OF TYPE (_) -> ()? TO EXPECTED ARGUMENT TYPE (() -> ())?
if hidden {
self.setSideShadow(hidden: hidden)
}
completion?(updated)
}
1 个解决方案
#1
1
This is the definition of that function:
这是该函数的定义:
class func panelAnimation(_ duration : TimeInterval, animations : @escaping (()->()), completion : (()->())? = nil)
So as you can see, you don’t need the _ in
keywords at the start of the completion closure.
正如您所看到的,在完成关闭开始时,您不需要_ in关键字。
Rewrite as follows:
重写如下:
UIView.panelAnimation( duration, animations: {
self.centerPanel.frame = centerPanelFrame
self.set(statusUnderlayAlpha: hidden ? 0 : 1)
}) {
if hidden {
self.setSideShadow(hidden: hidden)
}
completion?(updated)
}
#1
1
This is the definition of that function:
这是该函数的定义:
class func panelAnimation(_ duration : TimeInterval, animations : @escaping (()->()), completion : (()->())? = nil)
So as you can see, you don’t need the _ in
keywords at the start of the completion closure.
正如您所看到的,在完成关闭开始时,您不需要_ in关键字。
Rewrite as follows:
重写如下:
UIView.panelAnimation( duration, animations: {
self.centerPanel.frame = centerPanelFrame
self.set(statusUnderlayAlpha: hidden ? 0 : 1)
}) {
if hidden {
self.setSideShadow(hidden: hidden)
}
completion?(updated)
}