'Why is viewDidAppear: called while unwinding?
I have several view controllers, which present each other using segues, and all cover the full screen (none of them are popovers). When the top one unwinds to one further down (i.e. segue A > B > C > D, then D unwinds to A), the ones in the middle run their viewDidAppear(_:) functions. Currently, I'm using viewDidAppear(_:) to kick off network requests to load data, but I don't want to do this in that case. isBeingDismissed and isMovingFromParent are false, so I can't use that to detect this.
Is there a better function to use for this than viewDidAppear(_:)? If not, how can I detect that a controller is in the middle of an unwind like this?
Solution 1:[1]
You just have the test backwards, that's all. Do the loading only if isBeingPresented or isMovingToParent is true.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | matt |
