This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol ObjectInfoable: NSObjectProtocol {} | |
extension ObjectInfoable { | |
static var fileName: String { | |
return String(describing: Self.self) | |
} | |
} | |
extension ObjectInfoable where Self: UIView { | |
static var nibName: UINib { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol TableViewCellGeneratorProtocol { | |
static func cell(for indexPath: IndexPath, inTableView tableView: UITableView) -> UITableViewCell | |
static func configure(cell: UITableViewCell, using object: Any?, at indexPath: IndexPath) | |
static func registerReuseIdentifier(for tableView: UITableView) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TableViewCellGenerator<T: UITableViewCell> { | |
// Class func - We need to override since each cell uses different objects to populate it self | |
class func configure(cell: UITableViewCell, using object: Any?, at indexPath: IndexPath) {} | |
// Static func - Should not be overriden since we use generics here | |
static func cell(for indexPath: IndexPath, inTableView tableView: UITableView) -> UITableViewCell { | |
return tableView.dequeueReusableCell(withIdentifier: T.reuseIdentifier, for: indexPath) | |
} |
OlderNewer