title: Codable default values during initialization
body: <p>I am new to Swift and I am working on a feature flag concept for my project and I am stuck using codable for default flag values. Currently my code looks like this </p>
  
  <pre><code>import Foundation 
  
  class KillSwitches: Codable {
  
      public enum CodingKeys: String, CodingKeys {
          case featureOne
          case featureTwo
          case featureThree
      }
  
      let featureOne: Bool = true
      let featureTwo: Bool = true
      let featureThree: Bool = false
  }
  </code></pre>
  
  <p>I have internal helper classes which helps with encoding and decoding of all the values from the json file and that's why its not explicitly mentioned here. Prior to this implementation I didn't have any default values and was using struct reading everything from a remote config file which was working fine. Now I am in my next step to have default values for my features if in case the remote config file is unreachable.</p>
  
  <p>I was expecting that I could initialize this class so I will get an object of the class with the default just like what I was getting when I read from my remote file. </p>
  
  <p>I am not able to instantiate this class without passing init(from decoder:). I even tried doing </p>
  
  <p><code>KillSwitches.init(from: KillSwitches.self)</code> which is not working either and I get the Type does not conform to expected type Decoder.</p>
  
  <p>My Json looks like this </p>
  
  <pre><code>{
    "featureOne" : false,
    "featureTwo" : true,
    "featureThree" : true
  }
  </code></pre>
  
  <p>Any guidance / pointers to resolve this problem is much appreciated. </p>