-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when use Codable in class inheritance #24
Comments
I was able to solve this problem this way. First I added the auxiliary protocol.
Then
And then just remove |
Interesting. So your goal is to encode values into the same keyed container in both the Superclass and the Subclass? When I implemented the logic, it seemed reasonable to only one call to a container (single, keyed, or unkeyed).
|
Hi Christoph. Yes, that’s true and it’s not an easy task. I did something similar a long time ago, but only for a specialized data format and it’s already difficult for me to remember exactly how it all works. I'll give some code snippets, maybe it will help you somehow. But probably the main idea is to store data by reference and then
And one more thing, decoding with inheritance also did not work correctly. And thank you for your work and such a cool package. This should be part of the standard library someday 🙂 |
I'm trying to use this wonderful library in a class that inherits from the base Codable class.
And the error appears
Multiple calls to container(keyedBy:), unkeyedContainer(), or singleValueContainer()
The text was updated successfully, but these errors were encountered: