LiveUI / XMLCoding

XMLEncoder & XMLDecoder using the Codable protocol in Swift 4.2
MIT License
10 stars 8 forks source link

Added strategies for decoding and encoding maps. #12

Closed tachyonics closed 6 years ago

tachyonics commented 6 years ago

Description

Add a transcoding strategy for collapsing/expanding maps from XML in the form-

<Result>
   <Tag>
     <Key>QueueType</Key>
     <Value>Production</Value>
   </Tag>
   <Tag>
     <Key>Owner</Key>
     <Value>Developer123</Value>
   </Tag>
 </Result>

into a Swift structure-

 struct Result {
     let tags: [String: String]

    enum CodingKeys: String, CodingKey {
        case tags = "Tag"
    }
 }

Can also be combined with the collapsing/expanding list strategy if there is an outer tag for the entire list of entries.

Testing

Added unit tests.

./scripts/docker-shortcuts/test.sh Executed 17 tests, with 0 failures (0 unexpected) in 0.031 (0.031) seconds

tachyonics commented 6 years ago

Good catch! Fixed to remove duplicated code.

tachyonics commented 6 years ago

It looks like the ci is stuck for my second change. It has been in pending for over a day.