pronebird / UIScrollView-InfiniteScroll

UIScrollView ∞ scroll category
MIT License
1.06k stars 148 forks source link

Cannot invoke "finishInfiniteScroll" with no arguments #65

Closed keithmichelson closed 6 years ago

keithmichelson commented 6 years ago

While converting to swift 3 I'm getting this error: Cannot invoke "finishInfiniteScroll" with no arguments. I don't see any arguments in the docs.

tableView.addInfiniteScroll { (scrollView) -> Void in
            self.fetchData() {
                scrollView.finishInfiniteScroll()
            }
        }

Any ideas?

Thanks.

pronebird commented 6 years ago

In Objective-C there are two finishInfiniteScroll, one takes the completion handler. I need to take a look why that happens in Swift.

keithmichelson commented 6 years ago

Thanks for looking at it. I'll keep checking back.

pronebird commented 6 years ago

I have no problem with that and just converted demo project to Swift 4.

screenshot 2017-11-23 15 01 14
keithmichelson commented 6 years ago

I just converted to swift 4 from 3 now and don't get that anymore. I don't get code completion for that function like you do.

tableView?.addInfiniteScroll { [weak self] (scrollView) -> Void in self?.fetchData() { scrollView.finishInfiniteScroll() } }

Gets this error, but xcode suggested fix gives another error: Cannot convert value of type '(_) -> ()' to expected argument type '((Any?) -> Void)!' Insert ' as! (Any?) -> Void'

It's weird though, it does build even with the error.

keithmichelson commented 6 years ago

Figured it out, looks like your code is fine. If I delete the DERIVED DATA folder everything works. No errors and code completion.

https://stackoverflow.com/questions/46504286/xcode-9-autocomplete-not-working-100-partially-working

Thanks for your help.

pronebird commented 6 years ago

@keithmichelson alright great! You can use the following shortcut cmd + shift + K to clean up derived data from Xcode without going to Finder.