Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import UIKit
class CustomView: UIView {
// MARK: - IBOutlets
@IBOutlet weak var centerImageView: UIImageView!
// MARK: - Init Methods
override init(frame: CGRect) {
super.init(frame: frame)
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
private func viewFromNibForClass() -> UIView {
let bundle = Bundle(for: type(of: self))
let stringNib = String(describing: type(of: self))
let nib = UINib(nibName: stringNib, bundle: bundle)
let view = nib.instantiate(withOwner: self, options: nil).first as! UIView
return view
private func commomSetup() {
let view = self.viewFromNibForClass()
view.frame = self.bounds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.