I'm calling a segue(sheet) from the Main View Controller to open a second view controller.I'm passing some data to the New View Controller by overriding the prepareforsegue
function
override func prepare(for segue: NSStoryboardSegue, sender: Any?) {
if (segue.identifier == "segue") {
//get a reference to the destination view controller
let destinationVC:myview = segue.destinationController as! myview
//set properties on the destination view controller
destinationVC.fileArray=fileArray
}
}
Im performing some operation on the second view controller.I need to pass the result of this function to the parent/laucher view controller once the operation is complete/preferably when the new view controller is Close/Disposed.
How can I achieve this?
when you will be going back run function with:
if let presenter = presentingViewController as? YourFirstController {
presenter.fileArray = fileArray
}
dismiss(animated: true, completion: nil)