Skip to content

Instantly share code, notes, and snippets.

@barefeettom
Created February 3, 2019 05:59
Show Gist options
  • Save barefeettom/046d1b28ac5cd3f14453155f6aa36803 to your computer and use it in GitHub Desktop.
Save barefeettom/046d1b28ac5cd3f14453155f6aa36803 to your computer and use it in GitHub Desktop.
A dodgy though common way to embed a xib
guard let contentView = Bundle(for: self)
.loadNibNamed(String(describing: self), owner: self, options: nil)
.first as? UIView
else { return }
self.addSubview(contentView)
addConstraintsToPinToTheSuperview(contentView)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment