Eureka: Cannot convert value of type 'ControllerProvider<UIViewController>' to expected argument type 'ControllerProvider<_>'

Created on 3 Nov 2016  路  4Comments  路  Source: xmartlabs/Eureka

Seems there is a bug actually when trying to implement a Custom presenter row.
Dunno If it's related to Swift itself, because it's seems to be related to this radar:
https://bugs.swift.org/browse/SR-708

The workaround doesn't work in my project, and I think I'm not alone as you can see this topic on Stackoverflow:
http://stackoverflow.com/questions/39866533/how-to-implement-custom-presenter-rows

I tried on Xcode 8.0 and updated to 8.1, same issue

Try to paste the following sample code (from Eureka documentation) to reproduce the issue:

public final class CustomPushRow<T: Equatable>: SelectorRow<PushSelectorCell<T>, SelectorViewController<T>>, RowType {

    public required init(tag: String?) {
        super.init(tag: tag)
        presentationMode = .show(controllerProvider: ControllerProvider.callback {
            return SelectorViewController<T>(){ _ in }
            }, completionCallback: { vc in
                vc.navigationController?.popViewController(animated: true)
        })
    }
}

Most helpful comment

The example code works with the following change:

presentationMode = PresentationMode.show(controllerProvider: ControllerProvider.callback {
...
}, onDismiss: { vc in

Note: I added the PresentationMode before .show and then Xcode suggested changing completionCallback to onDismiss. Putting PresentationMode before .show is actually not needed.

I will update the Readme, sorry for the inconvenience.

All 4 comments

Just ran into the very same issue. All the Eureka examples use segues.

yes. same issues here.

Ran into the same issue.

For now either use segues or this:

form = Section("Section1")
        <<< ButtonRow() { row in
            row.title = "Show VC"
            $0.onCellSelection(self.showVC)
        }
        .cellUpdate { cell, row in
            cell.textLabel?.textAlignment = .left
            cell.accessoryType = .disclosureIndicator
        }
func showVC(_ cell: ButtonCellOf<String>, row: ButtonRow) {
    let yourVC = YourViewController()
    navigationController?.show(yourVC, sender: self)
}

The example code works with the following change:

presentationMode = PresentationMode.show(controllerProvider: ControllerProvider.callback {
...
}, onDismiss: { vc in

Note: I added the PresentationMode before .show and then Xcode suggested changing completionCallback to onDismiss. Putting PresentationMode before .show is actually not needed.

I will update the Readme, sorry for the inconvenience.

Was this page helpful?
0 / 5 - 0 ratings