You can use delegates and protocols for this. Set the protocol class using the interface for editing tables, for example
protocol EditableTableView { func insertCell() }
For both of your ViewControllers, set them to comply with this protocol, execute the insertCell function, and add a delegate pointer.
class ViewControllerA : EditableTableView { func insertCell() { ... add your code to insert a cell into VC A... } weak var otherTableViewDelegate : EditableTableView? } class ViewControllerB : EditableTableView { func insertCell() { ... add your code to insert a cell into VC B... } weak var otherTableViewDelegate : EditableTableView? }
In your parent split VC, you can configure delegate pointers to point to a different view controller
viewControllerA.otherTableViewDelegate = viewControllerB viewControllerB.otherTableViewDelegate = viewControllerA
Now, when you want to insert a cell into another controller, you can call
self.otherTableViewDelegate?.insertCell()
Spads source share