Eureka: Can't implement CellProvider without a xib

Created on 4 May 2018  路  4Comments  路  Source: xmartlabs/Eureka

Hi,

It might be nice to be able to provide cells from a class instead of just from a nib, something like:

cellProvider = CellProvider(class: MyCustomCell.self)

However, as CellProvider isn't a protocol, this can't be done easily (it's also a struct so I can't hack a fix as a subclass).

custom row interface builder question

All 4 comments

how do you fix without nib to create cellProvider?

CellProvider is a generic type so we can specify it by coding...

cellProvider = CellProvider<MyCustomCell>()

Cell type is specified in row declaration as Eureka code below shows so it doesn't make sense to specify it again unless we use a xib file.
See the default cellProvider value:

open class Row<Cell: CellType>: RowOf<Cell.Value>, TypedRowType where Cell: BaseCell {

    /// Responsible for creating the cell for this row.
    public var cellProvider = CellProvider<Cell>()

Regards

Ah, if you don't specify a nibName it will initialise the class instead - that's exactly what I was after, thanks!

Please check #1460 when using nob files with generic cell type.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jaylyerly picture jaylyerly  路  3Comments

pteasima picture pteasima  路  3Comments

Sweeper777 picture Sweeper777  路  3Comments

s1rc picture s1rc  路  3Comments

sedwo picture sedwo  路  3Comments