You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
Let's say this encoder encodes class with inherintace and depends on default encode(to:) implementation. What i see is that it tries to encode superclass keys into keyed container as expected and then stops. Any ideas ?
Here's the test
func testClassWInheritance() {
class L1: Codable {
init() {
L1_A_KEY="AAAA"
L1_B_KEY=222
L1_D_KEY=4.4
}
var L1_A_KEY: String
var L1_B_KEY: Int
var L1_C_KEY: Int = 2
var L1_D_KEY: Float
private enum CodingKeys: String, CodingKey {
case L1_A_KEY
case L1_B_KEY
case L1_D_KEY
}
}
class L2:L1 {
override init() {
L2_A_KEY="L2222"
L2_B_KEY=222333
L2_C_KEY=L3(L3_A_KEY: "L3333", L3_B_KEY: 333)
super.init()
}
required init(from decoder: Decoder) throws {
fatalError("init(from:) has not been implemented")
try super.init(from: decoder)
}
var L2_A_KEY: String
var L2_B_KEY: Int
struct L3: Codable {
var L3_A_KEY: String
var L3_B_KEY: Int
}
var L2_C_KEY: L3
}
let t = L2()
debugPrint(t)
let encoder = MyEncoder()
XCTAssertNoThrow( try encoder.encode(t))
}
(sorry, can't format to look readable. when editing all code formating is intact, but when saved, this happens)
Let's say this encoder encodes class with inherintace and depends on default encode(to:) implementation. What i see is that it tries to encode superclass keys into keyed container as expected and then stops. Any ideas ?
Here's the test
(sorry, can't format to look readable. when editing all code formating is intact, but when saved, this happens)
debug result:
The text was updated successfully, but these errors were encountered: