I have sorted the original array in popover controller. Now I want to send that array back to the original view controller for tableview and map view.
If propertyNameSrt == false
{
if ascSorting == false
{
properties.sort(sorterForbuildingAsc)
}
else
{
properties.sort(sorterForbuildingDesc)
}
}
My array is properties which includes custom object. How can pass this to my original view controller? Thanks in advance, Dhaval.
You can use delegate(protocol) methods to send back data to previous view controller.
IN CURRENT VC:
protocol MyProtocol: class
{
func sendArrayToPreviousVC(myArray:[AnyObject])
}
Make a var in your class.
weak var mDelegate:MyProtocol?
Now call the protocol method when you pop the view controller, with your "properties" array as parameter.
mDelegate?.sendArrayToPreviousVC(properties)
IN PREVIOUS VC:
In your previous VC, set the mDelegate property to self, when you push the current VC.
currentVC.mDelegate = self
//PUSH VC
Now implement the protocol method in your previous VC.
func sendArrayToPreviousVC(myArray:[AnyObject]) {
//DO YOUR THING
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With