Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var currentViewController: UIViewController?
lazy var firstChildTabVC: UIViewController? = {
let firstChildTabVC = self.storyboard?.instantiateViewController(withIdentifier: "FirstViewControllerId")
return firstChildTabVC
lazy var secondChildTabVC : UIViewController? = {
let secondChildTabVC = self.storyboard?.instantiateViewController(withIdentifier: "SecondViewControllerId")
return secondChildTabVC
func viewControllerForSelectedSegmentIndex(_ index: Int) -> UIViewController? {
var vc: UIViewController?
switch index {
case TabIndex.firstChildTab.rawValue :
vc = firstChildTabVC
case TabIndex.secondChildTab.rawValue :
vc = secondChildTabVC
return nil
return vc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment