Initiating Child ViewController from UIStoryBoard in iOS I'm trying to use inheritance in UIViewController where base class has XIB in storyboard. I'm troubling with initiating different children classes with that XIB.
I cannot use XIB file separately instead of storyboard because it has static UITableViewCells.

So here is how I'm managing it currently using object_setClass method in SWIFT:
Parent Class:

class MeetingViewController: UITableViewController {

    private(set) var project: CDProject?
    private(set) var meeting: CDMeeting?

    static func initWith(project: CDProject?, meeting: CDMeeting?) -&gt; MeetingViewController {
        let storyboard = UIStoryboard(name: "Meeting", bundle: nil)
        let meetingVC = storyboard.instantiateViewController(withIdentifier: "MeetingVCId") as! MeetingViewController
        meetingVC.project = project
        meetingVC.meeting = meeting
        return meetingVC
    }
}


Child Class-1:

class MeetingInfoViewController: MeetingViewController {

    static func initWith(meeting: CDMeeting) -&gt; MeetingInfoViewController {
        let meetingVC = MeetingViewController.initWith(project: nil, meeting: meeting)
        object_setClass(meetingVC, MeetingInfoViewController.self)
        return meetingVC as! MeetingInfoViewController
    }
}


Child Class-2:

class MeetingCreateViewController: MeetingViewController {

    static func initWith(project: CDProject) -&gt; MeetingCreateViewController {
        let meetingVC = MeetingViewController.initWith(project: project, meeting: nil)
        object_setClass(meetingVC, MeetingCreateViewController.self)
        return meetingVC as! MeetingCreateViewController
    }
}


This is working very fine, not any issue; but I'm just curious if:
1 there's any other way to handle this scenario?
2 this approach has any side-effects?
3 this can be improved somehow?

Also feel free to point out other things than initialisation!
There isn't another way to handle this scenario. Storyboard VC's can't be subclassed without replicating the UI also.
I'm surprised this works at all. object_setClass just changes the isa pointer, so the memory is still set up for the parent class, not the child. It will probably crash if you try to set an instance variable that doesn't exist in the parent.
Refactor the two VC's into one (since the UI is the same after all), and use composition for the differences instead.