title: Where should I set UINavigationController's delegate property?
body: <p>I'm working with some custom controller transitions, which make use of UINavigationController's <code>delegate</code> property. If I set it in <code>viewDidLoad()</code>, <code>self.navigationController?.delegate</code> gets deallocated at some point after the push. Setting it in <code>viewWillAppear()</code> works, but I'm wondering why that property gets deallocated in the first place, and where people typically set this property.</p>
  
  <pre><code>    // The first time you push, it will work correctly, and the delegate function below is called. After you pop back to this controller, delegate is nil (has been deallocated)
      override func viewDidLoad() {
          super.viewDidLoad()
          self.navigationController?.delegate = self
      }
  
      // Brute force works
      override func viewWillAppear(_ animated: Bool) {
          self.navigationController?.delegate = self
      }
  
      func navigationController(_ navigationController: UINavigationController,
                                animationControllerFor operation: UINavigationControllerOperation,
                                from fromVC: UIViewController,
                                to toVC: UIViewController) -&gt; UIViewControllerAnimatedTransitioning?
      {
          if operation == .push {
              return WTPPushAnimator()
          }
          if operation == .pop {
              return WTPPopAnimator()
          }
          return nil;
      }
  </code></pre>