Skip to content

Instantly share code, notes, and snippets.

@alfian0
Created December 10, 2016 17:21
Show Gist options
  • Save alfian0/7e43257181443c9add244b703341a21e to your computer and use it in GitHub Desktop.
Save alfian0/7e43257181443c9add244b703341a21e to your computer and use it in GitHub Desktop.
Swift UITableViewCell Utils
extension UITableViewCell {
class func nib() -> UINib {
let name = NSStringFromClass(self).componentsSeparatedByString(".").last!
return UINib(nibName: name, bundle: nil)
}
var parentTsableView: UITableView? {
get {
var table: UIView? = superview
while !(table is UITableView) && table != nil {
table = table?.superview
}
return table as? UITableView
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment