How to convert GraphQL results to swift objects?

In our Swift SDK we have an infinite scroll where we need pagination, thus we cannot use sync and are using GraphQL instead. The query is an aggregate with two lookups, it takes quite long (3s+) until 10 results (of a collection with only 200 entries) are displayed.

First I thought it had to do with the query itself because of the lookups, but (maybe because I have indexes set) the query took only around 0.5s. What takes the most time is converting the result to our swift objects (sometimes up to 1s per object). What is the best way to convert the result of the query to swift objects?

This is what the result looks like:

array(
  [
      Optional(RealmSwift.AnyBSON.document([
           "attribute1": Optional(RealmSwift.AnyBSON.objectId(xyz)), 
           "attribute2": Optional(RealmSwift.AnyBSON.objectId(yzx)), 
           "attribute3": Optional(RealmSwift.AnyBSON.string("myObjName")), 
           "__v": Optional(RealmSwift.AnyBSON.int32(0))
       ]))
])

and this is what we use to convert:

guard let documentId = document["_id"]??.stringValue else { return nil }
let property = document["property"]??.stringValue
// more properties ...
let object = Object(_id: documentId, property: property) // creating the swift object

It should be noted that our actual objects have around 10 properties, where one property is a linked document (thus the lookup number 1) and this linked document once again has a linked document (thus lookup number 2).

P.S: There is this similar question, however it has no solution and is around a year old…