Skip to content

Instantly share code, notes, and snippets.

@ahmed-abdurrahman
Created May 2, 2017 11:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ahmed-abdurrahman/3ee41d5f7e57eabebad387c05d1dd5bb to your computer and use it in GitHub Desktop.
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
default:
return nil
}
return vc
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment