Skip to content
Yair Hadad edited this page Dec 1, 2018 · 2 revisions

SwiftXib is an easy Xib loader

How to use:

  • Create your Xib view.
  • Create you* Xib class and extend SwiftXibView class.
  • Override nibName and set you xib view name.
  • Connect Xib File's Owner to your class.
  • Connect View component to your class.
  • Done!

** First connect your File's Owner to your class and only then connect your view component to your class. your "referencing outlets" in your component will connect to your file's owner. **

load xib view with SwiftXib:

Class MyCustomView : SwiftXibView {

  // override nibName and return your nib name. ('nibName.xib)
  override var nibName: String {return "nibName"}
  
  // setUI is call immediately after the view setUp.
  override func setUI() { 
    // initialized your view
  }
}

Extended classes:

  • SwiftXibView
  • SwiftXibTableViewCell

In all classes override nibName, and use setUI func

Clone this wiki locally