Created
October 9, 2015 03:13
-
-
Save loganwright/3908e56bb0962d65a5fc to your computer and use it in GitHub Desktop.
TableViewCell Binding Data
This file contains hidden or 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 Configurable { | |
func configure<T : TableViewCellConvertible>(model: T) | |
} | |
protocol TableViewCellConvertible { | |
typealias CellType : UITableViewCell, Configurable | |
var identifier: String { get } | |
} | |
extension TableViewCellConvertible { | |
func dequeueCellFromTableView(tableView: UITableView, forIndexPath indexPath: NSIndexPath) -> CellType { | |
let cell = tableView.dequeueReusableCellWithIdentifier(identifier, forIndexPath: indexPath) as! CellType | |
cell.configure(self) | |
return cell | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment