pohl
pohl

Reputation: 3175

GraphQL client libraries for iOS

I have a GraphQL service that I need to hit from an iOS app, and I'm trying to survey what my options are for client libraries geared towards this purpose. My initial impression is that there are not many good options out there, and I'm a little surprised by this since Facebook's mobile app is always cited among the motivational material for GraphQL itself.

What follows is my current understanding of my options. My questions is: what client library options am I overlooking? I'm also curious if you were to imagine the ideal GraphQL client library for iOS, what might it look like?

  1. Just Alamofire, AFNetworking, or NSURLSession directly, passing in lovingly hand-crafted Query Documents and spelunking through a Dictionary representing the resulting JSON, or
  2. Chester
  3. GraphQLicious
  4. Swift-GraphQL

Upvotes: 23

Views: 6456

Answers (2)

nburk
nburk

Reputation: 22731

This question was asked a long time ago - I think today the standard answer to this will be to use Apollo Client.

It uses a similar API as the Apollo Client on the web and has a couple of really nice features:

  • Static type generation based on GraphQL Queries & Mutations
  • Normalized cache
  • Query watching & automatic UI updates
  • Manual store updates

It has not yet reached 1.0 but overall is a super promising project!

Here are some resources that should help you get started:

Upvotes: 12

Vik
Vik

Reputation: 1927

I would not build queries by hand, and I think both Chester and GraphQLicious would be fine for you. If I had to imagine the perfect library, it should not only build queries but also parse the result into Swift objects. This, as you may know from JSON parsing libraries, is not a small task and that's why most of the GraphQL-Builder libraries don't do it.

Disclosure: I'm one of the guys behind GraphQLicious

Upvotes: 8

Related Questions