apollo-ios-dev
apollo-ios-dev copied to clipboard
[v2] [3/X] RequestChain + Response Parsing Rewrite
- Reimagines the Request Chain for async/await usage. This is a very large and very impactful change. Users who are implementing custom interceptors will need to update their interceptors to this new pattern.
- URLSessionClient has been replaced by
ApolloURLSessionprotocolURLSessionautomatically conforms to the protocol- Network calls now use
URLSession.bytes(for: delegate:)to allow for multipart response to be handled incrementally without implementingURLSessionDelegate. - This allows users to provide their own
URLSessionand build custom delegate for their session. AsyncHTTPResponseChunkSequenceparses the data into chunks based on the multipart boundary and returns a stream of chunks.
- Response parsing has been majorly refactored. JSONParser now handles all parsing, including incremental/multipart parsing for
@deferand subscriptions.- JSON parsing now parses multipart chunks as
Datainstead of asString. This removes the step where we serialized response data into a string, parsed it into chunks, serialized it back into Data, so we could pass it to theJSONSerializationand re-serialize it into JSON. Now, serialization only occurs once.
- JSON parsing now parses multipart chunks as
⚠️ Docs preview not attached to branch
The preview was not built because the PR's base branch Executor-async is not in the list of sources.
An Apollo team member can comment one of the following commands to dictate which branch to attach the preview to:
!docs set-base-branch main
Build ID: 920b30953e84bf50e6567903
Going to slowly make our way through these during the week - there is a lot to review. 😓