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

[FEATURE] Codable conformance #1

Open
skjiisa opened this issue Jan 10, 2023 · 1 comment
Open

[FEATURE] Codable conformance #1

skjiisa opened this issue Jan 10, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@skjiisa
Copy link

skjiisa commented Jan 10, 2023

Is your feature request related to a problem? Please describe.

Types that use Clamped properties lose automatic Codable conformance since Clamped itself does not conform to codable.

Describe the solution you'd like.

Clamped conforms to Codable when Value itself is Codable, encoding the wrapped value.

Describe alternatives you've considered.

Manual Codable conformance is still possible for types using Clamped properties, but it is much more work.

Additional context

It could be useful to also do this for other protocols such as Hashable.

I would be willing to give this a shot and might put up a PR for it soon.

@skjiisa skjiisa added the enhancement New feature or request label Jan 10, 2023
@skjiisa
Copy link
Author

skjiisa commented Jan 11, 2023

Did some investigation. Encodable conformance can be added pretty trivially by just encoding the value, but adding Decodable support doesn't work the same way since range can't be initialized from just the value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant