Skip to content

Instantly share code, notes, and snippets.

View niknovak's full-sized avatar

Nikola Novak niknovak

View GitHub Profile
@niknovak
niknovak / Decoder.swift
Created February 20, 2020 14:19
Apple docs state that setting dateDecodingStrategy to .iso8601 will decode the ISO-8601-formatted string (in RFC 3339 format) to Date object. But most of the example date formats from https://www.ietf.org/rfc/rfc3339 fail to parse.
import UIKit
struct Event: Codable {
var date: Date
}
/*
Apple docs state that setting dateDecodingStrategy to .iso8601 will decode the ISO-8601-formatted string (in RFC 3339 format) to Date object.
But most of the example date formats from https://www.ietf.org/rfc/rfc3339 fail to parse.
*/