diff --git a/Sources/XMLCoder/Auxiliaries/XMLCoderElement.swift b/Sources/XMLCoder/Auxiliaries/XMLCoderElement.swift index 0fb8b62a..25f862f7 100644 --- a/Sources/XMLCoder/Auxiliaries/XMLCoderElement.swift +++ b/Sources/XMLCoder/Auxiliaries/XMLCoderElement.swift @@ -51,7 +51,7 @@ struct XMLCoderElement: Equatable { elements.append(element) } - func transformToBoxTree() -> Box { + func transformToBoxTree() -> KeyedBox { let attributes = KeyedStorage(self.attributes.map { attribute in (key: attribute.key, value: StringBox(attribute.value) as SimpleBox) }) diff --git a/Sources/XMLCoder/Auxiliaries/XMLStackParser.swift b/Sources/XMLCoder/Auxiliaries/XMLStackParser.swift index ee7a4ecd..07ec9b51 100644 --- a/Sources/XMLCoder/Auxiliaries/XMLStackParser.swift +++ b/Sources/XMLCoder/Auxiliaries/XMLStackParser.swift @@ -23,7 +23,7 @@ class XMLStackParser: NSObject { errorContextLength length: UInt, shouldProcessNamespaces: Bool, trimValueWhitespaces: Bool - ) throws -> Box { + ) throws -> KeyedBox { let parser = XMLStackParser(trimValueWhitespaces: trimValueWhitespaces) let node = try parser.parse( diff --git a/Tests/XMLCoderTests/Minimal/BoxTreeTests.swift b/Tests/XMLCoderTests/Minimal/BoxTreeTests.swift index 6dda3c6c..0707a128 100644 --- a/Tests/XMLCoderTests/Minimal/BoxTreeTests.swift +++ b/Tests/XMLCoderTests/Minimal/BoxTreeTests.swift @@ -29,10 +29,7 @@ class BoxTreeTests: XCTestCase { attributes: [] ) - guard let boxTree = root.transformToBoxTree() as? KeyedBox else { - XCTFail("boxtTree is not a KeyedBox") - return - } + let boxTree = root.transformToBoxTree() let foo = boxTree.elements["foo"] XCTAssertEqual(foo.count, 2) }