1.升级Xcode之后,之前代码报错,报 Value of type '() -> ()' can never be nil, comparison isn't allowed
2.相关代码
if (self.action == nil) {
return;
}
self.action == nil 报错了。
if refreshTempAction != nil {
refreshStatus = .Refresh
self.startAnimation()
UIView.animateWithDuration(0.25, animations: { () -> Void in
if scrollView.contentInset.top == 0 {
scrollView.contentInset = UIEdgeInsetsMake(self.getNavigationHeight(), 0, scrollView.contentInset.bottom, 0)
}else{
scrollView.contentInset = UIEdgeInsetsMake(ZLSwithRefreshHeadViewHeight + scrollView.contentInset.top, 0, scrollView.contentInset.bottom, 0)
}
})
refreshTempAcstion != nil 报错。
After reading your “messed up” question and the comments with @ Cool Ai Dian, I answered:
The actions you define are all non-nullable types. Of course, you cannot judge whether they are empty or not. Xcode will definitely report an error.
You can put your
(() -> ())
或者(() -> Void)
改为(() -> Void)?
.PS: Before coming to SegmentFault to ask questions in the future, please learn a little bit about Markdown, or use its formatting tool. The formatting of your question is too messy, which makes people who want to help you answer helpless and difficult to understand your question. ; Also, whether you are writing code or doing anything, you must be careful (you have a spelling mistake); am I being too lenient?