Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Finding alternatives for GraphQL client for iOS

Finding alternatives for GraphQL client for iOS

65f8e7fd7925a49241339277444d3fda?s=128

Yuki Yamamoto

March 24, 2022
Tweet

More Decks by Yuki Yamamoto

Other Decks in Programming

Transcript

  1. @redryerye ࠷దͳiOSͷ GraphQLΫϥΠΞϯτΛٻΊͯ Finding alternatives for GraphQL client for iOS

  2. Yuki Yamamoto @redryerye iOS Engineer @

  3. Last year, my team decided to use GraphQL for our

    new feature 🏃
  4. A new co-working space has opened in Shimokitazawa GraphQL is

    used in the new seat reservation featur e (Both iOS/Android)
  5. GraphQL is used

  6. GraphQL is used with apollo-ios

  7. GraphQL is used with apollo-ios

  8. About apollo-ios • The most popular open-sourced GraphQL client library

    for iOS
  9. About apollo-ios • The most popular open-sourced GraphQL client library

    for iOS • Used in production by many companies around the world Github uses Apollo client potatotips #61
  10. Apollo is great!

  11. But it can be a hassle 🧐

  12. • Explaining the hurdle I had in using Apollo Today,

    I will be..
  13. Today, I will be.. • Explaining the hurdle I had

    in using Apollo • Looking at other alternatives
  14. Today, I will be.. • Explaining the hurdle I had

    in using Apollo • Looking at other alternatives New to GraphQL? The details of GraphQL will not be covered here. However, you will probably able to understand this talk since I will be explaining about the implementation one by one 😉
  15. Apollo iOS: Things I like about it

  16. Apollo iOS: Things I like about it 1. Strong community

    2. Guarantees compile time type safety
  17. Apollo iOS: Things I like about it 1. Strong community

    2. Guarantees compile time type safety
  18. Apollo iOS has a strong community • Actively maintained by

    Apollo, which is a GraphQL focused company
  19. • Actively maintained by Apollo, which is a GraphQL focused

    company Had seen an amazing work done in the community by the team, especially by Ellen 😭 Apollo iOS has a strong community
  20. • Actively maintained by Apollo, which is a GraphQL focused

    company • Easy to fi nd resources about the library Apollo iOS has a strong community
  21. Apollo iOS: Things I like about it 1. Strong community

    2. Guarantees compile time type safety
  22. Apollo iOS: Things I like about it 1. Strong community

    2. Guarantees compile time type safety
  23. What does this mean? 🤔

  24. None
  25. None
  26. None
  27. Queries are fl exible

  28. None
  29. None
  30. Query-speci fi c nested structs will be generated ✅ Compile

    time safety
  31. Queries are fl exible

  32. Queries are fl exible name name name PersonCell CharacterList Tie

    a query to a view = View : Query or Fragment (Works well with SwiftUI)
  33. name name name PersonCell CharacterList But this did not suit

    our case
  34. name name name PersonCell CharacterList 👆 Check this out for

    the details
  35. What’s the struggle? 🤔

  36. • Dealing with nested structs can be a hassle especially

    when passing it to your domain layer Apollo iOS: The Struggle
  37. Generated structs are nested based on a query Apollo iOS:

    The Struggle
  38. Generated structs are nested based on a query The more

    query gets complicated, so does the structs. Apollo iOS: The Struggle
  39. Generated structs are nested based on a query Generated structs

    does not conform to the Equatable protocol Apollo iOS: The Struggle 👆
  40. I wish I could easily map to domain objects a

    little more…
  41. It’s always an option • Not to use a client

    library and write your own client • Utilize Fragment
  42. Any alternative?

  43. Yes. graphql.org/code

  44. Yes. Graphaello will not be covered here since it focuses

    on SwiftUI graphql.org/code 👉
  45. Let’s look at SwiftGraphQL graphql.org/code 👉

  46. Apollo iOS

  47. Apollo iOS

  48. Apollo iOS

  49. SwiftGraphQL

  50. SwiftGraphQL

  51. SwiftGraphQL

  52. SwiftGraphQL

  53. SwiftGraphQL

  54. Looks good for mapping to models!

  55. Comparing apollo-ios and SwiftGraphQL

  56. Comparing apollo-ios and SwiftGraphQL

  57. Comparing apollo-ios and SwiftGraphQL

  58. Summary • Mapping generated structs to domain objects can be

    a hassle • Other GraphQL clients can be your solution depending on your situation
  59. developers.kankak.com I will post my update on the blog

  60. Thank you!

  61. Resources • https://www.apollographql.com/docs/ios/ • https://www.apollographql.com/blog/community/bringing-graphql-to-ios- fc46423befa1/#generating-native-result-types • https://miyashi.app/post/graphql-impressions/ • https://speakerdeck.com/sonatard/swiftui-graphql

    • https://www.the-guild.dev/blog/swift-graphql? utm_content=175727619&utm_medium=social&utm_source=twitter&hss_cha nnel=tw-1141026790653059072