Imagining what the future might be like with direct support for GraphQL in SwiftUI.
SwiftUI and GraphQL both represent new paradigms, these new paradigms—when paired together—offer an unparalleled, streamlined, client development experience. Today the most widely used and robust Swift GraphQL clients lack direct SwiftUI support, as well as support for #8 and #9 of Jordan Eldridge's "GraphQL Maturity Model".
- Each View declares it's data requirements using Fragments
- Each View observes it's fragment data from the GraphQL normalized cache, limiting large-tree re-renders
- Sensible defaults for cache policies and other configuration cover most cases, but can be overridden in intuitive ways
- As Views are decomposed into subviews, queries are decomposed into fragments
- As Views are reused, their data requirements are automatically picked up by parent views' queries
- Type Safety is retained
- Codegen happens at compilation (some pre-compilation step will likely be necessary due to Swift Macro limitations)
- Others?