title: Swift codable, Default Value to Class property when key missing in the JSON
body: <p>As you know Codable is new stuff in swift 4, So we gonna move to this one from the older initialisation process for the Models. Usually we use the following Scenario</p>
  
  <pre><code>class LoginModal
  {    
      let cashierType: NSNumber
      let status: NSNumber
  
      init(_ json: JSON)
      {
          let keys = Constants.LoginModal()
  
          cashierType = json[keys.cashierType].number ?? 0
          status = json[keys.status].number ?? 0
      }
  }
  </code></pre>
  
  <p>In the JSON <code>cashierType</code> Key may missing, so we giving the default Value as 0</p>
  
  <p>Now while doing this with Codable is quite easy, as following</p>
  
  <pre><code>class LoginModal: Coadable
  {    
      let cashierType: NSNumber
      let status: NSNumber
  }
  </code></pre>
  
  <p>as mentioned above keys may missing, but we don't want the Model Variables as optional, So How we can achieve this with Codable.</p>
  
  <p>Thanks</p>