So looking at the
DataDict as maybe a 1:1 switch over from the mainline’s
resultMap, I came across this: apollo-ios/Sources/ApolloAPI/DataDict.swift at 11bc60df8fafeb3dfa52426beb0d8ca1b38f6d71 · apollographql/apollo-ios · GitHub
What is the purpose of this force cast? Can this be implemented to be more like
resultMap? Is this only for testing?
You shouldn’t really be accessing the
DataDict directly. It is consumed by your generated models. These subscripts are called for accessing the fields on your generated model objects. And when you call one of those fields, we can guarantee that it is present and of the correct type (else the response data would have failed GraphQL validation in the first place). The force cast is because we already know and can guarantee the type is correct when being used proper (ie. from the generated field accessors on your generated
Thank you. As mentioned in another thread, we have already removed our use of resultMap, but you have definitely satisfied my curiousities.