
In this above Picture Two views are there. Top one is a view for showing date(for this view the class name is calender view) . And the bottom one is a tableview.the current view name is Main View When i am clicking on the cell of the tableview then it will go to the next view. When i am dismising the next view i want to pass some data to the calender view.How to achive this.
class MainView: UIViewController, UITableViewDataSource, UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let next = self.storyboard?.instantiateViewController(withIdentifier: "NextVC") as! NextVC
self.present(next, animated: true, completion: nil)
}
}
class NextVC: UIViewController {
var sendingData: String?
@IBAction func backAction(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
}
class CalenderView: UIViewController{
var receiveValue: String?
}
Here i want when i am dismissing the nextview the value of sendingData will pass to calender view.
How to do this ? Please help.
CalendarViewand other controllers. Is it some child view controller or some new view controller somewhere and how do you present it? Add this to your question.