In the first viewcontroller added an observer who changes the text label
NotificationCenter.default.addObserver(self, selector: #selector(updatePrice), name: Constants.NotificationUpdatePrice, object: nil) ... @objc func updatePrice(){ self.recomendLabel.text = "11111" } In the second viewController I show the first one and send the green light to the observer.
self.navigationController?.pushViewController(viewcontroller, animated: true) NotificationCenter.default.post(name: Constants.NotificationUpdatePrice, object: nil) The problem is that when the first viewcontroller shows the text it remains unchanged, after a bit I realized that the updatePrice method updatePrice called earlier than, for example, the viewWillAppear method and because of this the text returns to the original one.
How can this problem be solved ?