am using https://github.com/xmartlabs/XLPagerTabStrip and i have 3 children ... i want to pass value from child to child ..
am able to pass value from parent to first child like this:
let parentVC = self.parent as! ParentViewController
mobile = parentVC.mobile
but now i want to pass it from child 1 to child 2 .. tried the above but i got that mobile is nil
and mobile in the parentview is declared like this:
var mobile = ""
how can i pass data between children?
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let child1 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "cominfo")
let child2 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "comedu")
let child3 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "comcv")
return [child1,child2,child3]
}
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let child1 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "cominfo") as! yourChildClassname
child1.mobile = self.mobile
let child2 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "comedu")as! yourChildClassname
child2.mobile = self.mobile
let child3 = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "comcv") as! yourChildClassname
child3.mobile = self.mobile
return [child1,child2,child3]
}