Skip to content

Instantly share code, notes, and snippets.

@iamjason
Created December 16, 2014 20:39
Show Gist options
  • Save iamjason/4461841615c0eeaecfe4 to your computer and use it in GitHub Desktop.
Save iamjason/4461841615c0eeaecfe4 to your computer and use it in GitHub Desktop.
Generic UITableViewCell Implementation (swift)
class JGCell : UITableViewCell {
override init(style: UITableViewCellStyle, reuseIdentifier: String!) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupViews()
}
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setupViews()
}
override func awakeFromNib() {
setupViews()
}
class var cellReuseIdentifier:String {
get {
return NSStringFromClass(self)
}
}
class func registerTableView(tableView:UITableView){
tableView.registerClass(self, forCellReuseIdentifier: cellReuseIdentifier)
}
class func cellWithTableView(tableView:UITableView, indexPath:NSIndexPath) -> JGCell {
return tableView.dequeueReusableCellWithIdentifier(cellReuseIdentifier, forIndexPath: indexPath) as JGCell
}
func setupViews() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment