Skip to content

Instantly share code, notes, and snippets.

@matthewcheok
Created March 8, 2016 00:43
Show Gist options
  • Save matthewcheok/58481ac83675eccf1a30 to your computer and use it in GitHub Desktop.
Save matthewcheok/58481ac83675eccf1a30 to your computer and use it in GitHub Desktop.
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