I have main view controller which has connection to 2 view controller's. I made protocol where I have didRecive(data:Data) delegate function.
protocol MainViewControllerDelegate: class {
func didReciveDepartment(response:DepartmentResponse)
}
In main view controller I declare delegate var.
weak var delegate: DepartmentMainViewControllerDelegate?
In prepare for segue I set this delegate to viewCotnroller's. Like so -
if segue.identifier == "productsEmbedded" {
let vc = segue.destination as! DepartmentProductsViewController
delegate = vc
}
if segue.identifier == "shopsEmbedded" {
let vc = segue.destination as! DepartmentShopsViewController
vc.delegate = self
delegate = vc
}
I have wired behavior delegate only triggers in DepartmentShopsViewController, and DepartmentProductsViewController can't get this delegate, I commented out shops and products got this delgate so it means I can't use same delegate for 2 controllers?