Eureka: .cellSetup not getting called on a custom Cell(created using a NIB file)

Created on 27 Apr 2017  路  4Comments  路  Source: xmartlabs/Eureka

  • Environment: Eureka, Xcode and iOS version you are using.
    Eureka -> Latest stable 3.0 version
    Xcode -> 8.2.1
    iOS -> 9.0

The custom cell files are attached. Here is the code where I am using it. The code never reaches the .cellSetup.

            form +++ SelectableSection<ItemOptionRow>() { section in
            }
            form.last! <<< ItemOptionRow() { optionRow in
                optionRow.selectableValue = Option(name: "Test", price: 9.99)
                optionRow.cell.optionName.text = "Test"

                optionRow.value = nil
                }.cellSetup { cell, _ in
                    cell.trueImage = #imageLiteral(resourceName: "selectedRadioBox")
                    cell.falseImage = #imageLiteral(resourceName: "unselectedRadioBox")
            }

ItemOptionCell.zip

awaiting response

Most helpful comment

Hey guys !

The issue is that you are accessing the cell in the _constructor_ callback(let's call it this) and thus the cellSetup callback gets called before even being set, here, and never again.
What you want to do is move every cell config to the cellSetup callback and just leave row configs in the constructor callback, like so:

form +++ SelectableSection<ItemOptionRow>()
    form.last! <<< ItemOptionRow() { optionRow in
        optionRow.selectableValue = Option(name: "Test", price: 9.99)
        optionRow.value = nil
    }
    .cellSetup { cell, _ in
        cell.optionName.text = "Test"
        cell.trueImage = #imageLiteral(resourceName: "selectedRadioBox")
        cell.falseImage = #imageLiteral(resourceName: "unselectedRadioBox")
    }

Cheers

All 4 comments

Same

Any updated or suggestions?

Hey guys !

The issue is that you are accessing the cell in the _constructor_ callback(let's call it this) and thus the cellSetup callback gets called before even being set, here, and never again.
What you want to do is move every cell config to the cellSetup callback and just leave row configs in the constructor callback, like so:

form +++ SelectableSection<ItemOptionRow>()
    form.last! <<< ItemOptionRow() { optionRow in
        optionRow.selectableValue = Option(name: "Test", price: 9.99)
        optionRow.value = nil
    }
    .cellSetup { cell, _ in
        cell.optionName.text = "Test"
        cell.trueImage = #imageLiteral(resourceName: "selectedRadioBox")
        cell.falseImage = #imageLiteral(resourceName: "unselectedRadioBox")
    }

Cheers

Closing due to lack of response

Was this page helpful?
0 / 5 - 0 ratings