title: Get UITabBarController on presented ViewController/NavigationController
body: <p>I am presenting a Navigation Controller from a TabbarController</p>
  
  <pre><code>let planSettingsVC = PlanSettingsViewController.instantiateFromStoryboard()
  let planInfoNavCon = UINavigationController(rootViewController: planSettingsVC)
  
  if let myTabBarVC = self.tabBarController as? MyPlanTabBarController {
          myTabBarVC.present(planInfoNavCon, animated: true, completion: nil)
  }
  </code></pre>
  
  <p><code>PlanInfoNavCon</code> gets presented and now I want to access the TabBarController that presented it.</p>
  
  <p>Found in Library:</p>
  
  <blockquote>
  <pre><code>open var tabBarController: UITabBarController? { get } // If the view controller has a tab bar controller as its ancestor, return it. Returns nil otherwise.
  </code></pre>
  </blockquote>
  
  <p>So I tried the following on <code>PlanSettingsViewController</code></p>
  
  <ol>
  <li><p><code>print(self.tabBarController)</code> Prints <strong>nil</strong></p></li>
  <li><p><code>print(self.presentingViewController.tabBarController)</code> Prints <strong>nil</strong></p></li>
  <li><p><code>print(self.navigationController?.presentingViewController?.tabBarController)</code> Prints <strong>nil</strong></p></li>
  <li><p><code>print(self.navigationController.tabBarController)</code> Prints <strong>nil</strong></p></li>
  <li><p><code>self.navigationController?.presentingViewController as? MyPlanTabBarController</code> Results in <strong>nil</strong></p></li>
  </ol>
  
  <p>I am able to access TabBarController on ViewController of TabBar by <code>self.tabBarController</code> but</p>
  
  <p>How do I access the TabBarController which presented this?</p>
  
  <p>P.S.</p>
  
  <p><code>po self.navigationController</code> returns <code>&lt;UINavigationController&gt;</code> and <code>po self.navigationController?.presentingViewController</code> returns <code>&lt;UIViewController&gt;</code></p>
  
  <p><a href="https://i.stack.imgur.com/kJexA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kJexA.png" alt="lldb"></a></p>