I have the following date formatter:
let formatter = ISO8601DateFormatter()
formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
I want to pass that into a JSONEncoder, like this:
let encoder = JSONEncoder()
encoder.dateEncodingStrategy = .formatted(formatter)
but that produces an error as it only accepts custom DateFormatters not ISO8601DateFormatters.
How can I do this?