XMLCoder Documentation

Enumeration XMLEncoder.​Date​Encoding​Strategy

public enum DateEncodingStrategy  

The strategy to use for encoding Date values.

Member Of

XMLEncoder

XMLEncoder facilitates the encoding of Encodable values into XML.

Enumeration Cases

deferred​ToDate

case deferredToDate

Defer to Date for choosing an encoding. This is the default strategy.

seconds​Since1970

case secondsSince1970

Encode the Date as a UNIX timestamp (as a XML number).

milliseconds​Since1970

case millisecondsSince1970

Encode the Date as UNIX millisecond timestamp (as a XML number).

iso8601

@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
        case iso8601

Encode the Date as an ISO-8601-formatted string (in RFC 3339 format).

formatted

case formatted(DateFormatter) 

Encode the Date as a string formatted by the given formatter.

custom

case custom((Date, Encoder) throws -> ()) 

Encode the Date as a custom value encoded by the given closure.

If the closure fails to encode a value into the given encoder, the encoder will encode an empty automatic container in its place.