Recently I'm developing API parts using GraphQL.
When I call API, I need to generate a query from structure like this.
// from this model
struct ModelA {
let id: String
let title: String
....
}
// to this query
query {
id
title
}
If I have an instance of ModelA, I can reflect properties from instance using Mirror.
But I don't want to make the instance in this case and I don't want to make the properties to variables because I need to use this model for response.
Additionally class_copyPropertyList is a good solution if the model is NSObject class. However in this case this is a structure in swift.
Is this possible? I appreciate your help in advance.
Aucun commentaire:
Enregistrer un commentaire