Skip to content

Instantly share code, notes, and snippets.

@dgyesbreghs
Last active December 7, 2016 15:33
Show Gist options
  • Save dgyesbreghs/35597fff8b42282a1b453d60f7033748 to your computer and use it in GitHub Desktop.
Save dgyesbreghs/35597fff8b42282a1b453d60f7033748 to your computer and use it in GitHub Desktop.
import UIKit
extension UIView {
class func newAutoLayoutView() -> Self {
let view = self.init()
view.translatesAutoresizingMaskIntoConstraints = false
return view
}
class var reuseIdentifier : String {
return String(describing: self)
}
}
extension UITableView {
func registerClass(cellClass: AnyClass) {
self.register(cellClass, forCellReuseIdentifier: cellClass.reuseIdentifier)
}
func registerNib(nibName: String) {
self.register(UINib(nibName: nibName, bundle: nil), forCellReuseIdentifier: nibName)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment