Swiftpack.co - Package - LiveUI/XMLCoding


Slack Jenkins Platforms Swift 4 Vapor 3

XMLEncoder & XMLDecoder using the codable protocol in Swift 4


To test in Docker call ./scripts/docker-shortcuts/test.sh


Stars: 4
Help us keep the lights on



0.4.0 - Oct 25, 2018

Add the ability to collapse and expand an XML structure that has explicit Key and Value tags-


Decoded into or encoding from a structure like-

struct Result {
    let tags: [String: String]

Can also be combined with the collapsing/expanding ListDecodingStrategy where there is an outer element for the list of entries.

0.3.0 - Aug 20, 2018

Added some refinement around how empty XML elements are handled, specifically a empty string ("") and empty Data will be seen as empty elements. These changes will cause the decoder to

  • effectively ignore empty tags for optional parameters
  • interpret an empty tag for a required String parameter as an empty string
  • interpret an empty tag for a required Data parameter as an empty Data instance
  • fail on any other empty tags for required elements

Moved the encoder to native Swift Types from NS* to be more typesafe and to avoid differences between platforms. This fixes encoding on Linux.

0.2.1 - Aug 11, 2018

Fix to handle singleton lists with ListDecodingStrategy.collapseListUsingItemTag.

0.2.0 - Aug 10, 2018

Provides an option to more compactly represent a list in a type hierarchy by collapsing a list with all items under a single tag when decoding and expanding all items to be under that tag when encoding. No change to default behavior.

0.1.2 - Aug 2, 2018

Add a fix to handle empty XML elements that can be decoded into types with no required properties.