title: How to get parent of child view controller?
body: <p>I have a view controllerA with segmented control, and  I have added two view controller's(B &amp; C) views in controllerA on different segment selection.I have one button each on controllerB and controllerC.On button click of each controllerB &amp; controllerC, I am going to controllerD.</p>
  
  <p>How do I know from which controller I am coming from?</p>
  
  <p>I have tried code below but I think due to views of controller's (B &amp; C) added to controllerA, it is giving me nil.  </p>
  
  <pre><code>guard let parent = self.parent else {return}
  </code></pre>
  
  <p><strong>How to get parent in this scenario?</strong></p>