I am a newbie Swift developer. I would like to receive some advice from experts on how to solve the following problem I am facing.
I am trying to embed in a UIViewController two child views controller and display both of them at the same time in the UIViewController, that is the parent view controller.
These two child view controllers are both UITableViewControllers: the first one is a table view with two sections and 3 rows per each section, the second child view is also a table but it displays some data dynamically.
Using the code below I managed to load and display each UITableViewController successfully but I can't display them both at the same time one below the other. Is there a way I can solve my problem?
Thank you so muck for your patience and kindness.
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let firstTable = storyboard.instantiateViewControllerWithIdentifier("FirstTable") as! UINavigationController
let thirdTable = storyboard.instantiateViewControllerWithIdentifier("ThirdTable") as! UINavigationController
self.addChildViewController(firstTable)
firstTable.view.frame = self.view.bounds
self.view.addSubview(firstTable.view)
firstTable.didMoveToParentViewController(self)
self.addChildViewController(thirdTable)
thirdTable.view.frame = self.view.bounds
self.view.addSubview(thirdTable.view)
thirdTable.didMoveToParentViewController(self)
}
}
