无法转换类型'(_) - >的值无效?”预期参数类型'(() - > Void)?'

时间:2018-04-09 09:57:04

标签: ios swift uicollectionview

无法转换类型'(_) - >的值无效?”预期参数类型'(() - > Void)?'

[![在此处输入图像说明] [1]] [1]

[1]:https://i.stack.imgur.com/M1MYV.png`func deselectSelectedCells(){         if let start = startDateIndexPath {             var section = start.section             var item = start.item + 1

        if let cell = collectionView?.cellForItem(at: start) as? AirbnbDatePickerCell {
            cell.type.remove([.InBetweenDate, .SelectedStartDate, .SelectedEndDate, .Selected])
            cell.configureCell()
            collectionView?.deselectItem(at: start, animated: false)
        }

        if let end = endDateIndexPath {
            var indexPathArr = [IndexPath]()
            while section < months.count, section <= end.section {
                let curIndexPath = IndexPath(item: item, section: section)
                if let cell = collectionView?.cellForItem(at: curIndexPath) as? AirbnbDatePickerCell {
                    cell.type.remove([.InBetweenDate, .SelectedStartDate, .SelectedEndDate, .Selected])
                    cell.configureCell()
                    collectionView?.deselectItem(at: curIndexPath, animated: false)
                }

                if section == end.section && item >= end.item {
                    // stop iterating beyond end date
                    break
                } else if item >= (collectionView!.numberOfItems(inSection: section) - 1) {
                    // more than num of days in the month
                    section += 1
                    item = 0
                } else {
                    item += 1
                }
            }

            collectionView?.performBatchUpdates({
                (s) in
                self.collectionView?.reloadItems(at: indexPathArr)
            }, completion: nil)
        }
    }
}`

1 个答案:

答案 0 :(得分:0)

错误告诉您解决方案。 performBatchUpdates在没有参数的情况下进行回调,但您可以定义一个参数。

删除(s) in下的performBatchUpdates行(第40行),该行声明了回调参数。