Im new to swift and I'm confused how to pass values from container view to parent view. I tried the delegate method but I don't know how to call the delegate method inside the parent.It doesn't seem to work, the app just terminates.
The following code is how display the container.The CameraView is the container view and DiaryEntryViewController is the parent view controller.
@IBAction func cameraBtn(_ sender: Any) {
CameraView.isHidden = !CameraView.isHidden
self.view.sendSubview(toBack: diaryEntryText)
}
And on click of another button, the container should hide and simultaneously pass the data to parent view.I'm able to hide the view by the following code:
@IBAction func saveCamBtn(_ sender: Any) {
let parent = self.parent as! DiaryEntryViewController
parent.CameraView.isHidden = true
}
Is there a way to get the data to parent view.I actually don't want to use segues as the data inside the view should not be lost if I open the container view again.