I have an app that prompts the user for various information before doing a task. Once all the information is put in by the user, I do a UIApplication.shared.openUrl(url: url)
and then self.navigationController?.popToRootViewController(animated: true)
. The app pops back to the root view controller; however, the navigation item prompt from the last view controller is now included in the navigation item of the root view controller.
Anyone understand why this is happening and a good way to fix it? I could just set the prompt to ""
when the root view controller reappears, but I would like to solve the problem, not alleviate the symptom.
Update
Per @Shad 's answer, I've updated my view controller with the code below and everything is working as expected.
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationItem.prompt = nil
}