IGListKit icon indicating copy to clipboard operation
IGListKit copied to clipboard

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

Open jlwcrews opened this issue 5 years ago • 2 comments

New issue checklist

  • [X] I have reviewed the README and documentation
  • [X] I have searched existing issues and this is not a duplicate
  • [X] I have attempted to reproduce the issue and include an example project.

General information

  • IGListKit version: 4.0.0
  • iOS version(s): 13.2.2
  • CocoaPods/Carthage version: CocoaPods 1.9
  • Xcode version: 11.2.1
  • Devices/Simulators affected: all
  • Reproducible in the demo project? (Yes/No): no
  • Related issues:

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 avatar Mar 09 '20 12:03 jlwcrews

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) {
    }

jlwcrews avatar Mar 09 '20 13:03 jlwcrews

Hello, may I ask if the problem has been solved

keleboys avatar Jul 16 '21 05:07 keleboys