Consuming GraphQL in TypeSafe Languages
summary
Apollo iOS implements a Swift code generator that produces selection-set-based models (one model per fragment/query) and a shared storage box called dataDict to avoid copying, using copy-on-write for value semantics. Polymorphism uses optional type-case accessors (e.g., asVinylRecord) and a field merging step that hoists fields into matched type-cases and fragments so view code gets the exact fields it needs. Generation runs over the whole schema, improves memory and access speed, and offers toggles to disable or limit merging.
AI-written summary · about
chapters (10)
- 0:00Introduction to GraphQL
- 1:05Challenges of type safety
- 3:11Generating type-safe models
- 5:59Models based on selection sets
- 7:46Handling polymorphism
- 9:55Field merging concept
- 14:28Fragment conversion
- 17:55Core design principles
- 18:56Memory and performance
- 22:45Summary and Q&A
related talks
41mStrong typing from the server to the UI with GraphQL
25mType-safe GraphQL with TypeScript
06mAutomagic TypeScript Codegen for GraphQL
47mRock-Solid Components with TypeScript and GraphQL
57mType safe GraphQL with TypeScript
12mThe Next Generation of GraphQL and TypeScript
26mFull Stack Type Safety with React, GraphQL, and TypeScript
35mFull-stack Type Safety with React, GraphQL, and TypeScript
