title: How to update variable in MVVM?
body: <p>I am trying to use MVVM. I am going to <code>VC2</code> from <code>VC1</code>. I am updating the <code>viewModel.fromVC = 1</code>, but the value is not updating in the <code>VC2</code>.</p>
  
  <p>Here is what I mean:</p>
  
  <p>There is a <code>viewModel</code>, in it there is a <code>var fromVC = Int()</code>. Now, in <code>vc1</code>, I am calling the <code>viewModel</code> as </p>
  
  <p><code>let viewModel = viewModel()</code>. </p>
  
  <p>Now, on the tap of button, I am updating the <code>viewModel.fromVC = 8</code>. And, moving to the next screen. In the next screen, when I print <code>fromVC</code> then I get the value as 0 instead of 8. </p>
  
  <p>This is how the <code>VC2</code> looks like</p>
  
  <pre><code>class VC2 {
  
      let viewModel = viewModel()
  
      func abc() {
          print(viewModel.fromVC)
      }
  
  }
  </code></pre>
  
  <p>Now, I am calling <code>abc()</code> in <code>viewDidLoad</code> and the <code>fromVC</code> is printed as 0 instead of 8. Any help?</p>