Created
March 8, 2016 00:43
-
-
Save matthewcheok/58481ac83675eccf1a30 to your computer and use it in GitHub Desktop.
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
import UIKit | |
class SingleCellTableView<Cell>: UITableView { | |
override init(frame: CGRect, style: UITableViewStyle) { | |
super.init(frame: frame, style: style) | |
registerCell() | |
} | |
func registerCell() { | |
guard let cellClass = Cell.self as? AnyClass else { | |
return | |
} | |
registerClass(cellClass.self, forCellReuseIdentifier: "Cell") | |
} | |
func dequeueReusableCell() -> Cell? { | |
return dequeueReusableCellWithIdentifier("Cell") as? Cell | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment