Skip to content

Instantly share code, notes, and snippets.

@UjwalManjunath
Created February 19, 2016 16:38
Show Gist options
  • Save UjwalManjunath/ecc8dcbedd2d3633ca44 to your computer and use it in GitHub Desktop.
Save UjwalManjunath/ecc8dcbedd2d3633ca44 to your computer and use it in GitHub Desktop.
public extension UITableView {
func registerClass(myClass:AnyClass) {
let bundle = NSBundle(forClass: myClass)
self.registerNib(UINib(nibName: String(myClass), bundle: bundle), forCellReuseIdentifier: String(myClass))
}
func dequeue<T where T:UITableViewCell>(myclass:T.Type) -> T {
return self.dequeueReusableCellWithIdentifier(String(myclass)) as! T
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment