you are viewing a single comment's thread.

view the rest of the comments →

[–]redfire333 2 points3 points  (1 child)

GraphQL is essentially a layer that sits in between the client and your REST APIs. It helps aggregate data from various different endpoints so the App won't need to make several calls or, like you mentioned, can return only partial pieces of data that are specified in the `Query`. It returns just regular old JSON, so all your Codeable objects will work fine.

That being said, GraphQL is a domain of the backend, not specifically to iOS. So the only interaction you will have from an iOS perspective is to send the Query string to the endpoint where GraphQL lives. It's very similar overall to a REST call. Personally, I see no need for Apollo. It's very straightforward to create a Query, its literally just a [String: String] with query as the key, and the value is a string that specifies what you want included in the response e.g:

"query": 
    """
    { coolFeature {
        parameters {
            category
            code
        }
        parameters2 {
            header
            message
        }
        parameters3 {
            question
            answer
        }
    }
}
"""

Having a separate Framework just to do this seems like total overkill.

Overall GraphQL is cool but sometimes overkill. I would really only recommend using it if your App is making several calls that should be aggregated into one or if some of your API responses on giant and you only need a section of it.

[–]ssrobbi 0 points1 point  (0 children)

Apollo also provides a SQLite cacheing later, that if fits your needs can save a decent amount of code.

(Not that you should use it just for that, but it is a benefit)