Skip to content

Instantly share code, notes, and snippets.

@alvaroroyo
Last active March 30, 2020 13:18
Show Gist options
  • Save alvaroroyo/0dcc7c8af17576d8f81292b084cb1f0d to your computer and use it in GitHub Desktop.
Save alvaroroyo/0dcc7c8af17576d8f81292b084cb1f0d to your computer and use it in GitHub Desktop.
override open func awakeFromNib() {
super.awakeFromNib()
let nibName = String(describing: type(of: self))
guard let view = Bundle.main.loadNibNamed(nibName, owner: self, options: nil)?.first as? UIView else { return }
view.frame = self.bounds
view.autoresizingMask = [.flexibleHeight,.flexibleWidth]
self.addSubview(view)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment