Posts

Showing posts from February, 2017

Load ViewController from xib ios swift 3

Code here extension Bundle {          static func loadView<T>(fromNib name: String , withType type: T .Type) -> T {         if let view = Bundle . main . loadNibNamed (name, owner: nil , options: nil )?. first as ? T {             return view         }                  fatalError ( "Could not load view with type " + String (describing: type))     } } Example:  var vc: UIViewControlle r = B undle . loadView (fromNib: "nameXIB" , withType: YourController . self )