title: How to decode json into a Codable to use in a SwiftUI Preview?
body: <p>Wondering if there is a way to decode some json into a Codable that is a dependency of a  View so i can use swiftUI previews?</p>
  <p>Here is a working unit test for the codable</p>
  <pre class="lang-swift prettyprint-override"><code>    func testDecode() {
          let data = Data(jsonProj.utf8)
          //frmt
          let frmt2 = DateFormatter()
          frmt2.dateFormat = &quot;yyyy-MM-dd'T'HH:mm:ss.SSSX&quot;
          //decoder
          let decoder = JSONDecoder()
          decoder.dateDecodingStrategy = .custom({ (decoder) -&gt; Date in
              let container = try decoder.singleValueContainer()
              let dateStr = try container.decode(String.self)
              guard let d = frmt2.date(from: dateStr) else { fatalError() } //fixme some danger here
              return d
          })
          do {
              let p = try decoder.decode(Project.self, from: data)
              XCTAssertEqual(p.id, 2)
              print(p)
          }
          catch {
              print(error)
              XCTFail()
          }
      }
  </code></pre>
  <p>I'd like to use it here</p>
  <pre class="lang-swift prettyprint-override"><code>struct PreProjectCell_Previews: PreviewProvider {
  
     //static let decodedJson: Project ... NEED THIS PART
  
      static var previews: some View {
          NavigationView {
              List {
                  PreProjectCell(project: &lt;#Project#&gt;)
              }
          }
      }
  }
  </code></pre>