Githawk: Refactor models to be structs, use Sourcery, and put all in FlatCache

Created on 19 Feb 2018  ·  3Comments  ·  Source: GitHawkApp/GitHawk

Since we have a lot of models in the app now, I wanted to propose that once Instagram/IGListKit#1081 is merged, we convert all models to structs and use Sourcery to automatically generate:

  • Hashable and Equatable conformance
  • ListSwiftIdentifiable and ListSwiftEquatable conformance
  • Mutations/builders

Secondly, I'd like to make all models usable in the FlatCache and remove all tree relationships to instead be "edges" using model IDs (the same IDs used to store in the cache). This let's the entire app listen for changes to models and respond to updates. Useful for:

  • Optimistic updating
  • Updating UIs from model state changes
  • Centralize app state and change propogation

Proposing a pretty huge change that has a lot of moving parts, but wanted to float this idea and get opinions!

❔ question

All 3 comments

Oh wow I was just talking about this with @jamuc 😱👍

Sent with GitHawk

Yeah. I think it makes sense.

I think this is smart. I also think that once Instagram/IGListKit#1081 is merged, you will see an uptick in IGListKit adoption among those writing apps in Swift.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

weyert picture weyert  ·  3Comments

BasThomas picture BasThomas  ·  3Comments

rnystrom picture rnystrom  ·  3Comments

BasThomas picture BasThomas  ·  3Comments

BasThomas picture BasThomas  ·  3Comments