Skip to content

Instantly share code, notes, and snippets.

@SuperShinyEyes
Created August 16, 2017 08:31
Show Gist options
  • Save SuperShinyEyes/241895e2a66550eeb1ded6df4c484b54 to your computer and use it in GitHub Desktop.
Save SuperShinyEyes/241895e2a66550eeb1ded6df4c484b54 to your computer and use it in GitHub Desktop.
Subclassing UIView swift
class MyView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
addBehavior()
}
convenience init() {
self.init(frame: CGRect.zero)
}
required init(coder aDecoder: NSCoder) {
fatalError("This class does not support NSCoding")
}
func addBehavior() {
print("Add all the behavior here")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment