Skip to content
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

Removes Codable from definitions #41

Merged
merged 1 commit into from
Apr 20, 2024

Conversation

Matt54
Copy link
Member

@Matt54 Matt54 commented Apr 13, 2024

We should let the consumer of the package add Codable conformances if they need it. Tonic does not depend on these conformances.

The reason being that Swift doesn't allow you to override the default encode/decode behavior if defined in the package. This is inflexible for the consumer of the package.

Example of a problem that I just ran into:
I defined my own coding keys and encode/decode methods for these structs and used them in my save files. I did this because at the time of writing the code our raw values were integers and I wanted keys which would not change with future updates to the package. However, now that we added Codable to the package I am forced to use the package's raw values for coding keys and the default encode/decode. This breaks my save files in a way that would require a significant refactor to resolve.

TLDR - let the developer using the package add this in their codebase:
extension ChordType: Codable {}

@aure aure merged commit ed84c6a into AudioKit:main Apr 20, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants