Let's say we have 2 decodable structs in Swift 5.5, and one of them has a property that contains an array of one of the structs:
struct MySecondDecodable: Decodable {
public let mySecondProperty: String
private enum CodingKeys: String, CodingKey {
case mySecondProperty
}
init(from decoder: Decoder) {
let values = try decoder.container(keyedBy: CodingKeys.self)
mySecondProperty = try values.decode(String.self, forKey: .mySecondProperty)
}
}
struct MyDecodable: Decodable {
public let myProperty: [MySecondDecodable]
private enum CodingKeys: String, CodingKey {
case myProperty
}
init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
myProperty = try values.decode([MySecondDecodable].self, forKey: .myProperty)
}
}
I cannot breakpoint on MySecondDecodable
's init function. In fact, I cannot even see it's running.
Why is this happening? Why can't I breakpoint the initialization of every single MySecondDecodable in the array? Is there a way to do such a thing?
In the end, I couldn't fix it but I found the issue in my decoder and fixed it. The example I gave didn't really reflect my situation. My situation involved many different structs from many different places in my code. Putting them in here would be... unproductive and very confusing, to say the least.
Thanks for your attention though!