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

Customization in a framework #137

Open
alexito4 opened this issue Feb 10, 2017 · 3 comments
Open

Customization in a framework #137

alexito4 opened this issue Feb 10, 2017 · 3 comments

Comments

@alexito4
Copy link

Hi!

I'm upgrading a framework to Swift 3 and to Decodable 0.5.
Before, we used to have a custom conformance to Decodable for Dates that was mapping a timestamp using timeIntervalSince1970, but obviously now that Date has a conformance to Decodable from this library itself we can't do that anymore.

Using the Customization that you provide should work, but the issue is that I'm using Decodable in a framework so there is no "entry point" where I can run the code to setup the decoder function. (I may have one that kind of works for the apps that use the framework, but that won't work for unit tests for example).

I can have a different decode method on Date an call that manually but I was curious if there is something I'm missing.

Cheers.

@Anviking
Copy link
Owner

Hm, interesting. This would be a concrete reason to remove DynamicDecodable and provide no default implementations of Decodable at all, which I didn't have the guts to do before.

@Lascorbe
Copy link

Lascorbe commented Feb 13, 2017

What if the default implementations are available as a separate module? That way everyone can keep using them, and those of us who don't want a default impl, just don't import it :)

@Anviking
Copy link
Owner

I realised the way SE-0166 stores primitive decoding information in Decoder objects is probably much more sane than Decodable's approach of putting them in protocol conformances. If there is still a place for Decodable in Swift 4, this might be worth looking in to.

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

No branches or pull requests

3 participants