Search code examples
swiftxcodeframeworksxib

How to call XIB in my existing XIB?


Description:- I am coding for a custom framework, For this I am using XIB everywhere, Now I want to call another XIB in my existing XIB, Its calling very fine But unable to perform button action of called XIB. Thanks in advance Here is code.

let bundle = Bundle(for: type(of: self)) 
let nib = UINib(nibName: "WelcomeVC", bundle: bundle) 
self.contentView = nib.instantiate(withOwner: self, options: nil).first as! UIView 
self.addSubview(self.contentView)

Solution

  • MVC - is global iOS concept. Learn it again. xib - is view "V", "V" - cant been as controller "C". if you can call xib - make it in a controller.