Open fl034 opened 6 years ago
I want to be able to set .iso8601 as a dateDecodingStrategy of JSONDecoder in CodableHelper.swift.
.iso8601
dateDecodingStrategy
JSONDecoder
CodableHelper.swift
2.4.0
In CodableHelper.swift:
Replace
open static var dateformatter: DateFormatter?
open static var dateDecodingStrategy: JSONDecoder.DateDecodingStrategy?
And
if let df = self.dateformatter { decoder.dateDecodingStrategy = .formatted(df) // ...
if let strategy = dateDecodingStrategy { decoder.dateDecodingStrategy = strategy // ...
Can you think of any downsides to this change?
Okay, I found some time to do it myself :D #8266
Description
I want to be able to set
.iso8601
as adateDecodingStrategy
ofJSONDecoder
inCodableHelper.swift
.Swagger-codegen version
2.4.0
Suggest a fix/enhancement
In
CodableHelper.swift
:Replace
open static var dateformatter: DateFormatter?
withopen static var dateDecodingStrategy: JSONDecoder.DateDecodingStrategy?
And
if let df = self.dateformatter { decoder.dateDecodingStrategy = .formatted(df) // ...
withif let strategy = dateDecodingStrategy { decoder.dateDecodingStrategy = strategy // ...
Can you think of any downsides to this change?