这是来自Github上的公共Eureka项目.我正在尝试理解源代码(和Swift泛型).我停留在这个片段的最后一行.最后一行在做什么?
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>()
/// The type of the cell associated to this row.
public let cellType: Cell.Type! = Cell.self //what is this line doing?
Run Code Online (Sandbox Code Playgroud)
它将属性分配给此通用专用cellType的类型Cell.所以,如果这是一个Row<PersonCell>,cellType是PersonCell.
这!几乎肯定是不必要的,并且可以在Swift 3中使用它来创建一些令人头疼的问题.
| 归档时间: |
|
| 查看次数: |
79 次 |
| 最近记录: |