Successfully reported this slideshow.
Your SlideShare is downloading. ×

REST in Peace - Using GraphQL with Apollo on iOS

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 18 Ad

More Related Content

Similar to REST in Peace - Using GraphQL with Apollo on iOS (20)

Advertisement

Recently uploaded (20)

Advertisement

REST in Peace - Using GraphQL with Apollo on iOS

  1. 1. @nikolasburk
  2. 2. @nikolasburk REST in Peace Using GraphQL on iOS with the Apollo Client ❤
  3. 3. @nikolasburk Goals 🎯 1. GraphQL vs REST 2. Using GraphQL on iOS with Apollo 3. DEMO
  4. 4. GraphQL vs REST
  5. 5. A Simple REST Example /conferences [ { id: “1”, name: “WWDC”, city: “San Jose”, year: “2017” }, { id: “2”, name: “UnitedConf”, city: “Minsk”, year: “2017” }, … ] /conferences/<id>/attendees [ { id: “3”, name: “Julia”, }, { id: “4”, name: “Wladimir”, }, … ] @nikolasburk
  6. 6. What now?
  7. 7. Solution 1: Adjusting the API /conferences @nikolasburk 😐 [ { id: “1”, name: “WWDC”, city: “San Jose”, year: “2017”, }, { id: “2”, name: “UnitedConf”, city: “Minsk”, year: “2017”, }, … ]
  8. 8. Solution 1: Adjusting the API /conferences @nikolasburk 😐 [ { id: “1”, name: “WWDC”, city: “San Jose”, year: “2017”, lastThreeAttendees: [ { name: “Diana” }, { name: “Ron” }, { name: “Anna” }, ] }, { id: “2”, name: “UnitedConf”, city: “Minsk”, year: “2017”, lastThreeAttendees: [ { name: “Wladimir” }, { name: “Julia” }, { name: “Sarah” }, ] }, … ]
  9. 9. /conferences /conferences/1/attendees /conferences/2/attendees /conferences/3/attendees /conferences/4/attendees … @nikolasburk 😱 Solution 2: n+1 requests /conferences/n/attendees
  10. 10. GraphQL A new way of fetching data @nikolasburk
  11. 11. @nikolasburk Declarative Data Fetching allConferences { name year attendees(last: 3) { id name } } 😎
  12. 12. Queries … only read data Conference(id: “1”) { name city year } { “data”: { “Conference”: { “name”: “UnitedConf”, “city”: “Minsk”, “year”: “2017” } } } @nikolasburk
  13. 13. Mutations … write and read data mutation { createConference( name: “WWDC”, city: “San Jose”, year: “2017” ) { id } } { “data”: { “createConference”: { “id”: “13”, } } } @nikolasburk
  14. 14. The Apollo iOS Client AlamoFire for GraphQL APIs 🤓
  15. 15. Major Features 1. Static Type Generation 2. Caching 3. Query Watching @nikolasburk
  16. 16. DEMO
  17. 17. @nikolasburk
  18. 18. Thank you! 🤓 @nikolasburk

×