I used XLPagerTabStrip
for TabBar
Refer.
Now I am doing some functionality in childViewController
based upon that I need to update that value to UILabel
in parent ViewController
.
For Example:
I am getting the values in childviewcontroller
now I want to update that value in parentviewcontroller
as mention in the below screenshot.
If you don't want to use delegate then here is other solution CallBack
In child view controller create callback function like below
var callback: ((_ count: Int) -> Void)?
Use it when you need to update parent data
callback?(5)
In Parent view controller when your setting your child view controller or creating instance of child view at that time write below code.
childVC.callback = { (count) -> Void in
print(count)
//update your cart label count
}