If you want to reload a ViewController initially loaded from a XIB, you can use the next UIViewController extension:
extension UIViewController {
func reloadViewFromNib() {
let parent = view.superview
view.removeFromSuperview()
view = nil
parent?.addSubview(view) // This line causes the view to be reloaded
}
}