Swift's JSONDecoder with multiple date formats in a JSON string? : <p>Swift's <code>JSONDecoder</code> offers a <code>dateDecodingStrategy</code> property, which allows us to define how to interpret incoming date strings in accordance with a <code>DateFormatter</code> object.</p>

<p>However, I am currently working with an API that returns both date strings (<code>yyyy-MM-dd</code>) and datetime strings (<code>yyyy-MM-dd HH:mm:ss</code>), depending on the property. Is there a way to have the <code>JSONDecoder</code> handle this, since the provided <code>DateFormatter</code> object can only deal with a single <code>dateFormat</code> at a time?</p>

<p>One ham-handed solution is to rewrite the accompanying <code>Decodable</code> models to just accept strings as their properties and to provide public <code>Date</code> getter/setter variables, but that seems like a poor solution to me. Any thoughts?</p>
