title: Detect navigation pop in destination view controller
body: <p>Using a <code>UINavigationController</code> in Xamarin.iOS (targetting iOS 11/12) I'd like to detect, in the <em>destination</em> View Controller when I'm being navigated <em>back</em> to - i.e. a pop. I specifically want to exclude/detect when the destination VC is being <em>pushed</em> for the first time.</p>
  
  <p>To be explicit, given that we've navigated from A to C, and back to B:</p>
  
  <p><code>[A] -(push)-&gt; [B] -(push)-&gt; [C] -(pop)-&gt; [B]</code></p>
  
  <p>I'd like to detect/discriminate - <em>in B</em> - between the initial push from <code>A -&gt; B</code> and a subsequent pop from <code>C -&gt; B</code>.</p>
  
  <p>Conceptually this is identical to the questions posed <a href="https://stackoverflow.com/questions/47157766/detect-backward-pop-navigation-in-destination-view-controller-viewwillappear">here</a> and <a href="https://stackoverflow.com/questions/54207143/detect-when-view-controller-appears-from-pop">here</a> and I should - apparently - be able to use a combination of <code>isMovingToParentViewController</code> / <code>IsBeingPresented</code> / <code>View.Window</code> in <code>ViewWillAppear()</code> but, having tried the approaches in both the linked questions (and a few other things), I'm not seeing the expected values for these properties; they're always <code>False</code>, and <code>View.Window</code> is always <code>null</code>.</p>
  
  <p>Is this a Xamarin.iOS-specific quirk, or am I missing something?  If it is Xamarin-related is there a workaround?  And if not does anyone have a bare-bones C# example of this detection working?</p>
  
  <p>I'd prefer not to have to maintain state in the navigation controller (or delegate, or individual VCs) since the app structure could change in the future.  However, a solution that made use of the nav controller or delegate to indicate the direction of navigation (pop vs push) to the destination VC - 'B', above - would be acceptable.</p>