I want to pass data from childVC to parentVC when popping view controller.
ChildViewController { /processing data/ //get data value
value = 123 self.navigationController?.popViewController(animated: true) }ParentViewController { //use the value from child vc(value 123) }
How can i pass the data back to use it in ParentViewController?
Easiest way is to use a callback closure property on the child. Set it from the parent when setting up the child view controller. When the child is done, check if callback is != nil (if optional) and if so, call it before popping.