title: How to test deinit of viewController
body: <p>I want to test if I remove all the key value observers in the <code>deinit</code> of my view controller. </p>
  
  <p>In the test class I have defined following method to start view controller lifecycle</p>
  
  <pre><code>  func startLifecycle() {
     _ = viewController.view
    }
  </code></pre>
  
  <p>In my test method I'm trying to invoke <code>deinit</code> by simply assigning nil to my view controller instance</p>
  
  <pre><code>testViewController = nil
  XCTAssert for stuff...
  </code></pre>
  
  <p>But <code>deinit</code> is not called when I execute my test. I see no obvious retain cycles in my VC's code, what's more when I run the code in my app, not the test environment, <code>deinit</code> is called so it doesn't seem like something is keeping view controller in memory.</p>
  
  <p>What is the correct way to release a view controller when testing? </p>