Instagram / IGListKit

A data-driven UICollectionView framework for building fast and flexible lists.
https://instagram.github.io/IGListKit/
MIT License
12.86k stars 1.54k forks source link

Method 'sectionController(_:didSelectItemAt:viewModel:)' has different argument labels from those required by protocol #1432

Open jlwcrews opened 4 years ago

jlwcrews commented 4 years ago

New issue checklist

General information

I just updated my pods, including IGListKit to 4.0.0. Now, every instance in the app where I use sectionController didSelectItemAt is now throwing an error.

Method 'sectionController(_:didSelectItemAt:viewModel:)' has different argument labels from those required by protocol 'ListBindingSectionControllerSelectionDelegate' ('sectionController(_:didDeselectItemAt:viewModel:)')

Method 'sectionController(_:didSelectItemAt:viewModel:)' has different argument labels from those required by protocol 'ListBindingSectionControllerSelectionDelegate' ('sectionController(_:didHighlightItemAt:viewModel:)')

Method 'sectionController(_:didSelectItemAt:viewModel:)' has different argument labels from those required by protocol 'ListBindingSectionControllerSelectionDelegate' ('sectionController(_:didUnhighlightItemAt:viewModel:)')

My code:

extension InfoSectionController: ListBindingSectionControllerSelectionDelegate {

    func sectionController(_ sectionController: ListBindingSectionController<ListDiffable>,
                           didSelectItemAt index: Int,
                           viewModel: Any) {
        if let viewModel = viewModel as? NavigationProvidable {
            viewController?.present(viewModel.navigation)
        }
    }
}

I've checked the documentation, and the signature appears correct. Anyone have any suggestions as to what I need to do here?

jlwcrews commented 4 years ago

If I add empty stubs for the other methods, it works:

func sectionController(_ sectionController: ListBindingSectionController<ListDiffable>, didDeselectItemAt index: Int, viewModel: Any) {
    }

func sectionController(_ sectionController: ListBindingSectionController<ListDiffable>, didHighlightItemAt index: Int, viewModel: Any) {
    }

func sectionController(_ sectionController: ListBindingSectionController<ListDiffable>, didUnhighlightItemAt index: Int, viewModel: Any) {
    }
keleboys commented 3 years ago

Hello, may I ask if the problem has been solved