0

I have a navigation controller. I push view controllers onto the stack.

When one of the view controllers call:

navigationController?.popViewControllerAnimated(true)

How can the view controller before it know that its child just got popped? Is there a delegate or something?

TIMEX
  • 259,804
  • 351
  • 777
  • 1,080

1 Answers1

0

You could set navigationController?.delegate and use

navigationController(_:willShowViewController:animated:)]

Documented here. But that doesn't tell you what view controller is being popped.

Alternatively, you could use ViewController.viewWillDisappear, but that doesn't tell you why (is it popped or covered). There's an answer already covering that.

Community
  • 1
  • 1
szym
  • 5,606
  • 28
  • 34