Closed jimisaacs closed 2 years ago
An alternative solution would be, only use codegen for the queries, not the responses.
In reality, the objects should already be generated with equatable.
I definitely agree, would make usage with IGListKit a lot more convenient.
I definitely agree, would make usage with IGListKit a lot more convenient.
We make very heavy usage of IGListKit in our app, so had to have this. I ended up using a little Sourcery template to codegen Equatable for Apollo's entire generated API. See below: https://gist.github.com/SirensOfTitan/5f9feb2dca067e4b4152609e1851c028
... I am not sure if my work is 100% correct, but it works in practice pretty well. I'd be willing to setup a PR for the official codegen client once the Meteor folks hire their fulltime iOS engineer.
@SirensOfTitan Hi I'm the fulltime iOS engineer who was (finally) hired, let me know if I can be of help here!
Hello @designatednerd! I haven't looked at what is being generated in a while, but if it's still the same, then I'd assume what I put in the issue description is still relevant. There's some higher level difficulties I have had with the codegen, but those would be off topic here, as this issue is pretty explicit.
We are going to have a few changes landing soonish, but I'll put this in to take a look at when we're dealing with that.
I think we also should consider autogenerate the Hashable
interface as the new Diffable in iOS 13 requires that 🚀
Yes Hashable
is definitely happening in addition to equatable - I've been doing that in some behind the scenes stuff prepping for updated codegen
@designatednerd Is this still coming or do we need someone to pick up the work for this?
Yes! Please follow along with the Codegen Project to see where things are at - working on that at the same time as a few other things though.
What's the status on this? 🙂
Coming along! Codegen itself got blocked for a bit so I shifted to working on the networking stack, but once that's out I'll be back on Codegen and auto-Equatable conformance is definitely a big goal.
Awesome 🙌 With auto Equatable and Hashable conformance it would be a lot easier to implement diffing for table views and collection views
Yes, aboslutely!
looking forward to it
Any updates when this will be released?
This simple thing basically makes working with apollo codegen pain in the neck!
Hi 👋🏻 - this issue should be resolved in 1.0. 1.0 is currently in alpha releases with a full 1.0 release in H2 2022. Please take a look at the latest alpha and let us know if this is still an issue for you.
Happy to see this issue resolved 👍
I'm pretty sure it's because of
public typealias ResultMap = [String : Any?]
. BecauseAny?
is not Equatable. If it was[String : AnyHashable?]
, this wouldn't be a problem. In reality, the objects should already be generated with equatable.I'm generally concerned about the code quality codegen provides and would greatly appreciate an alternative solution.