Generic closures in dependencies #2819
Unanswered
StefanCosminR
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I'm trying to extend one of my dependencies to have a generic parameter an I realised this is not supported by Swift. Is there an easy workaround to do this?
Using "some Codable" in that context is not supported. I could convert this to a protocol but then I lose all the advantaged of this technique and I'd probably have to change a lot of existing tests.
Another option I found, which is quite verbose, is to use a struct that implements callAsFunction.
This works, the change is purely additive but it's very verbose. I wish I could remove
UserSettingsSetCodable
, but I want to use a different storage in tests and preview (not, UserDefaults)Beta Was this translation helpful? Give feedback.
All reactions