Skip to content

Commit

Permalink
#14 Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
malcommac committed May 23, 2019
1 parent 94586fe commit 02d1b86
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/Table/Cell Adapters/TableCellAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ open class TableCellAdapter<Model: ElementRepresentable, Cell: ReusableViewProto
public var modelType: Any.Type = Model.self

/// This is the cell type used to dequeue the model. You should not alter it.
public var modelCellType: Any.Type = Cell.self
public var modelViewType: Any.Type = Cell.self

/// This is the reusable identifier to dequeue cell. By default is set to the same
/// name of the class used as `Cell` but you can override it before using the adapter itself.
Expand All @@ -46,7 +46,7 @@ open class TableCellAdapter<Model: ElementRepresentable, Cell: ReusableViewProto

public func dequeueCell(inTable table: UITableView, at indexPath: IndexPath?) -> UITableViewCell {
guard let indexPath = indexPath else {
let castedCell = modelCellType as! UITableViewCell.Type
let castedCell = modelViewType as! UITableViewCell.Type
let cellInstance = castedCell.init()
return cellInstance
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import UIKit
public protocol TableCellAdapterProtocol {

var modelType: Any.Type { get }
var modelCellType: Any.Type { get }
var modelViewType: Any.Type { get }
var modelIdentifier: String { get }

func dequeueCell(inTable: UITableView, at indexPath: IndexPath?) -> UITableViewCell
Expand Down
2 changes: 1 addition & 1 deletion Sources/Table/TableDirector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ open class TableDirector: NSObject {

internal func adapterForCell(_ cell: UITableViewCell) -> TableCellAdapterProtocol? {
return cellAdapters.first(where: { item in
return item.value.modelCellType == type(of: cell)
return item.value.modelViewType == type(of: cell)
})?.value
}

Expand Down

0 comments on commit 02d1b86

Please sign in to comment.