title: Add navigationController to specif viewController programmatically without storyboard swift
body: <p>I want to add <code>navigationController</code> to just only for <code>HomeViewController</code> for example. I know how to do it from <code>AppDelegate</code> and like this below</p>
  
  <pre><code>let navBar = UINavigationController(rootViewController: homeViewController())
  self.present(navBar, animated: true, completion: nil)
  </code></pre>
  
  <p>Is there another way that I can add <code>navigationController</code> inside <code>viewDidLoad</code> and <code>viewWillAppear</code>?</p>
  
  <p>Edited:</p>
  
  <p>My logic is when I pressed Login button which is the code below. Then it will present <code>SWRevealViewController</code></p>
  
  <pre><code>@IBAction func loginPressed(_ sender: Any) {    
      let frontViewController = HomeViewController()
      let rearViewController  = TableViewController()
      let swRevealVC = SWRevealViewController(rearViewController: rearViewController, frontViewController: frontViewController)
      swRevealVC?.toggleAnimationType = SWRevealToggleAnimationType.easeOut
      swRevealVC?.toggleAnimationDuration = 0.30
  
      self.present(swRevealVC!, animated: true, completion: nil)
  }
  </code></pre>
  
  <p>I just only want to set <code>navigationController</code> to <code>HomeViewController</code></p>