Hashable conformance
Hi all,
I was wondering if there'd be a way to make this library Hashable friendly, I've tried conforming TweakValue to Hashable but that causes a lot of compiler errors about TweakValue having associated type or Self requirements. Any advice for this approach?
Tagging you, @albertodebortoli because GitHub probably doesn't automatically email when new issues are created. (At least, in my experience)
HI @jbehrens94, you are right, if you try to make the TweakValue protocol conforming to Hashable you'll get the following all over the place:
Protocol 'TweakValue' can only be used as a generic constraint because it has Self or associated type requirements
Frankly, I don't think it's possible to do what you'd like to do with the current design of the library. It would need some deep redesign and refactoring, probably converting TweakValue to a generic struct (something I've tried in the past and miserably failed).
I created this PR with some (typical Friday) experimentation to make Tweak and TweakValue conform to Hashable. The PR is just to show a diff on how it could potentially be done using type erasure. It's not meant to be merged
Hi @fadyyecob and @jbehrens94. I'm gonna go ahead and close this as we have moved to a different component (Toggles). The changes suggested here are not possible with the design of JustTweak, I suggest taking a look at Toggles as its code should be better in this regard.