Created
February 19, 2016 16:38
-
-
Save UjwalManjunath/ecc8dcbedd2d3633ca44 to your computer and use it in GitHub Desktop.
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
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