title: Swift reset class dataModel
body: <p>I have a registration flow in same class data model instead of struct data, passing through two pages. It can modify the same data model before submitting registration form.</p>
  <p>However, the class data model is cached when reopen the registration flow again. I would like to clear / reset all data.</p>
  <p>But, it requires all the values to be optional, no singleton. How can i achieve the reset data? Please help..</p>
  <pre><code>class RegistrationDataModel {
     var username: String?
     var password: String?
     var email: String?
     var mobile: String?
  }
  </code></pre>
  <pre><code>struct registrationViewModel {
     init(
          registrationDataModel: RegistrationDataModel = .init()
      )  {
          self.registrationDataModel = registrationDataModel
       }
  }
  
  </code></pre>
  <pre><code>class FormOne: UIViewController {
         func routeToFormTwo() {
             FormTwo(formData: viewModel.registrationDataModel)               
         }
  }
  
  </code></pre>
  <pre><code>
  class FormTwo: UIViewController {
     init(
          formData: RegistrationDataModel = .init(),
      )  {
          self.formData = formData
       }
  }
  
  </code></pre>