Skip to content

Commit c6ee065

Browse files
authored
Use KeyedBox like we used to (#46)
1 parent 5748eee commit c6ee065

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

Sources/XMLCoder/Auxiliaries/XMLCoderElement.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct XMLCoderElement: Equatable {
5151
elements.append(element)
5252
}
5353

54-
func transformToBoxTree() -> Box {
54+
func transformToBoxTree() -> KeyedBox {
5555
let attributes = KeyedStorage(self.attributes.map { attribute in
5656
(key: attribute.key, value: StringBox(attribute.value) as SimpleBox)
5757
})

Sources/XMLCoder/Auxiliaries/XMLStackParser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class XMLStackParser: NSObject {
2323
errorContextLength length: UInt,
2424
shouldProcessNamespaces: Bool,
2525
trimValueWhitespaces: Bool
26-
) throws -> Box {
26+
) throws -> KeyedBox {
2727
let parser = XMLStackParser(trimValueWhitespaces: trimValueWhitespaces)
2828

2929
let node = try parser.parse(

Tests/XMLCoderTests/Minimal/BoxTreeTests.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ class BoxTreeTests: XCTestCase {
2929
attributes: []
3030
)
3131

32-
guard let boxTree = root.transformToBoxTree() as? KeyedBox else {
33-
XCTFail("boxtTree is not a KeyedBox")
34-
return
35-
}
32+
let boxTree = root.transformToBoxTree()
3633
let foo = boxTree.elements["foo"]
3734
XCTAssertEqual(foo.count, 2)
3835
}

0 commit comments

Comments
 (0)