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

iOS × GraphQLの嬉しみとツラミ / Pros and cons of iOS and GraphQL

21807122e5564f4775b813d2eb17efaf?s=47 mogaming
September 01, 2018

iOS × GraphQLの嬉しみとツラミ / Pros and cons of iOS and GraphQL

iOSDC2018の発表資料です。誤っていた部分を修正して再UPしました。

21807122e5564f4775b813d2eb17efaf?s=128

mogaming

September 01, 2018
Tweet

Transcript

  1. J04ʷ(SBQI2-ͷخ͠Έͱπϥϛ J04%$ !@NPHBNJOH

  2. w 5XJUUFS!@NPHBNJOH w %F/"ͰখઆܥαʔϏεͷ։ൃ୲౰  J04"OESPJE"QQ w #''΍"1*ͷ։ൃ΋͍ͯ͠·͢  

    "CPVU.F
  3.  (SBQI2-"1*ΫϥΠΞϯτฤ  (SBQI2-"1*αʔόʔฤ  (SBQI2-"1*J04͔Βୟ͘ฤ  (SBQI2-ͷخ͠Έͱπϥϛ  #''Λ׆༻ͯ͠πϥϛʹཱͪ޲͔ͬͯΈͨ࿩

      ࠓ೔࿩͢͜ͱ
  4. w "1*αʔόʔʹऔΓೖΕΔ͜ͱͷͰ͖ΔΫΤϦݴޠ  'BDFCPPL࡞IUUQTHSBQIRMPSH w 3&45GVM΍H31$ͱ͸શ͘ҧ͏ࢥ૝ͰͰ͖͍ͯΔ  3&45GVM"1*㱻(SBQI2-"1*㱻H31$ w 42-ϥΠΫʹ"1*ʹ໰͍߹ΘͤͯσʔλΛऔಘ͢Δ

      (SBQI2-ͱ͸
  5.   ૣ଎(SBQI2-"1*Λୟ͍ͯΈΑ͏ʂ ࠓ͔Β(JUIVCͷ(SBQI2-"1*Λ୊ࡐʹͯ͠ ࣮ࡍʹ"1*Λୟ͘࿩Λ͍͖ͯ͠·͢ IUUQTEFWFMPQFSHJUIVCDPNWFYQMPSFS

  6.   ͱʜͦͷલʹ গ͚ͩ͠ݴ༿ͷઆ໌"

  7. w 2VFSZ 3&45Ͱ͍͏ͱ(&5 w .VUBUJPO3&45Ͱ͍͏ͱ1045 165 %&-&5&   ϦΫΤετͷछྨ

    (SBQI2-ͷಛ௃͸2VFSZʹूத͍ͯ͠ΔͨΊ2VFSZͷ࿩Λ͠·͢
  8.   ૣ଎(SBQI2-"1*Λୟ͍ͯΈΑ͏ʂ ࠓ͔Β(JUIVCͷ(SBQI2-"1*Λ୊ࡐʹͯ͠ ࣮ࡍʹ"1*Λୟ͘࿩Λ͍͖ͯ͠·͢ IUUQTEFWFMPQFSHJUIVCDPNWFYQMPSFS

  9.   ։͍ͯΈΔͱ͜Μͳײ͡ ͳΜ͔ΤσΟλΈ͍ͨͳͷ͕։͘ʜφχίϨʁ

  10. w (SBQIJ2-͸ϒϥ΢βͰݟΕΔ(SBQI2-*%& w ܕ2VFSZ.VUBUJPO͕ҰཡͰ͖Δ w 2VFSZ.VUBUJPOΛॻ͍࣮ͯߦͰ͖Δ w ೖྗิ׬͕ޮ͘ w ಋೖ͸ͱͬͯ΋؆୯

      (SBQIJ2-ʢ͙Β;͌͘Δʁ͙Β;͔͌Δʁʣ IUUQTHJUIVCDPNHSBQIRMHSBQIJRM
  11.   (SBQIJ2-ͷ࢖͍ํ ͜͜ʹॻ͘ 36/ ͜͜ʹ݁Ռ͕ग़Δ %PDVNFOU͕ݟΕΔ KTPOͰม਺ఆٛ

  12.   ࣮ࡍʹऔಘͯ͠ΈΑ͏ʂ 6TFSͷ৘ใΛऔಘ 2VFSZ ͯ͠ΈΔ

  13.   %PDVNFOU͔Β6TFSΛऔಘ͢Δ2VFSZΛ୳͢ ͜͜Λԡ͢

  14.   VTFSΛऔಘͯ͠ΈΔ 2VFSZΛબ୒ 2VFSZҰཡ VTFSΛݕࡧ

  15.   VTFSΛऔಘͯ͠ΈΔ VTFSRVFSZͷઆ໌ 6TFS5ZQF͔ΒऔΕΔ'JFMET ฦ͞ΕΔܕ 2VFSZͷҾ਺ ͜ΕΛऔͬͯΈΔ

  16. 42-ϥΠΫʹ͔͚Δ ඞཁͳσʔλ͚ͩΛճͰऔಘͰ͖Δ JOUFSGBDFʹܕ͕͋Δ 1BHJOBUJPOͷ࢓༷͕ܾΊΒΕ͍ͯΔ  ϥΠϒϥϦʹΑͬͯ͸࣮૷͞Ε͍ͯͳ͜ͱ΋͋Δ   (SBQI2-"1*ͷಛ௃

  17.   VTFSΛऔಘͯ͠ΈΔ 4&-&$5CJP'30.VTFS 8)&3&MPHJObNPHBNJOH` Έ͍ͨͳΠϝʔδ

  18.   VTFSΛऔಘͯ͠ΈΔ औಘͰ͖ͨ

  19. 42-ϥΠΫʹ͔͚Δ ඞཁͳσʔλ͚ͩΛճͰऔಘͰ͖Δ JOUFSGBDFʹܕ͕͋Δ 1BHJOBUJPOͷ࢓༷͕ܾΊΒΕ͍ͯΔ  ϥΠϒϥϦʹΑͬͯ͸࣮૷͞Ε͍ͯͳ͜ͱ΋͋Δ   (SBQI2-"1*ͷಛ௃

  20.   ඞཁͳpFME͚ͩऔಘ͢Δ BWBUFS6SM΋௥ՃͰऔಘ͢Δ

  21.   ෳ਺ͷ2VFSZΛಉ࣌ʹ౤͛Δ GBDFCPPLHSBQIRMϦϙδτϦ΋औಘͯ͠ΈΔ

  22.   ෳ਺"1*ʹ(&5ϦΫΤετΛૹΓ͕ͪͳ 5PQը໘ͱ͔Ͱ׆༻Ͱ͖ͦ͏ ෳ਺ͷ2VFSZΛಉ࣌ʹ౤͛Δ

  23. 42-ϥΠΫʹ͔͚Δ ඞཁͳσʔλ͚ͩΛճͰऔಘͰ͖Δ JOUFSGBDFʹܕ͕͋Δ 1BHJOBUJPOͷ࢓༷͕ܾΊΒΕ͍ͯΔ  ϥΠϒϥϦʹΑͬͯ͸࣮૷͞Ε͍ͯͳ͜ͱ΋͋Δ   (SBQI2-"1*ͷಛ௃

  24.   ܕ͕͔ͬ͠Γ͋Δ/VMMBCJMJUZ /VMMBCJMJUZ͕ͰΘ͔Δ

  25. 1FSNJTTJPOͱͯ͠ฦͬͯ͘Δ ஋͕&OVNͱͯ͠ఆٛ͞Ε͍ͯΔ   ܕ͕͔ͬ͠Γ͋Δ&OVN ϦϙδτϦʹର͢Δ 1FSNJTTJPOͷpFME

  26.   ܕ͕͔ͬ͠Γ͋Δ ࣮ମͱͯ͠͸4USJOH͕ฦͬͯ͘Δ

  27. w ͋ΒΏΔpFMEʹܕΛ෇͚ΒΕΔ w ܕʹద߹Ͱ͖͍ͯͳ͍৔߹͸ܕγεςϜ͕ΤϥʔΛฦ͢   ܕ͕͔ͬ͠Γ͋Δ

  28. 42-ϥΠΫʹ͔͚Δ ඞཁͳσʔλ͚ͩΛճͰऔಘͰ͖Δ JOUFSGBDFʹܕ͕͋Δ 1BHJOBUJPOͷ࢓༷͕ܾΊΒΕ͍ͯΔ  ϥΠϒϥϦʹΑͬͯ͸࣮૷͞Ε͍ͯͳ͜ͱ΋͋Δ   (SBQI2-"1*ͷಛ௃

  29. w ྫɿϢʔβʔ͕ελʔ͍ͯ͠ΔϦϙδτϦΛऔಘ͢Δ w ͨ͘͞Μ͋Δ͔΋͠Εͳ͍ͷͰશ݅औಘ͸ΩϏγΠ w ͦ͏͍͏৔߹ͷͨΊͷ$POOFDUJPOͱ͍͏ܕ  ࠓճͷ৔߹ͩͱ4UBSSFE3FQPTJUPSZ$POOFDUJPO  

    1BHJOBUJPO
  30.   $POOFDUJPO5ZQF"SHVNFOUT औಘ͍ͨ݅͠਺Λࢦఆ͢ΔͨΊʹ BSHVNFOUTͱͯ͠pSTU·ͨ͸MBTUΛඞͣ౉͢ඞཁ͕͋Δ ࠷ॳͷOݸ ࠷ޙͷOݸ

  31.   $POOFDUJPO5ZQF3FUVSO5ZQF ݁Ռ͸FEHFTOPEFʹೖ͖ͬͯͯ OPEFͷҐஔ͸DVSTPSͰ؅ཧ͞ΕΔ ^ Α͘࢖͏Ͱ͋Ζ͏৘ใ͕ 1BHF*OGPͱͯ͠༻ҙ͞Ε͍ͯΔ ^

  32.   $POOFDUJPO5ZQFTUBSSFE3FQPTJUPSZΛऔಘ TUBSSFE3FQPTJUPSZΛऔͬͯΈΔ⭐ ࠷ॳͷ݅औಘ QBHFͷ৘ใ΋ͱ͓ͬͯ͘

  33.   $POOFDUJPO5ZQFTUBSSFE3FQPTJUPSZΛऔಘ ͚݅ͩऔಘͰ͖ͨ ͜ͷҐஔΛࢦ͍ͯ͠Δ

  34.   $POOFDUJPO5ZQF$VSTPS DVSTPSΛBGUFS΍CFGPSFʹ౉ͤ͹ ͦ͜Λج४ʹͯ͠pSTUMBTUΛ࢖͏͜ͱ͕Ͱ͖Δ1BHJOBUJPO

  35.   $POOFDUJPO5ZQF$VSTPSΛࢦఆ͢Δ ઌఔͷFOE$VSTPSΛBGUFSʹ౉ͯ͠ΈΔ

  36.   Ͱ͖ͯΔ $POOFDUJPO5ZQF$VSTPSΛࢦఆ͢Δ

  37. 42-ϥΠΫʹ͔͚Δ ඞཁͳσʔλ͚ͩΛճͰऔಘͰ͖Δ JOUFSGBDFʹܕ͕͋Δ 1BHJOBUJPOͷ࢓༷͕ܾΊΒΕ͍ͯΔ  ϥΠϒϥϦʹΑͬͯ͸࣮૷͞Ε͍ͯͳ͜ͱ΋͋Δ   (SBQI2-"1*ͷಛ௃ ͭͷಛ௃ͱͲ͏΍ͬͯ(SBQI2-"1*Λ

    ୟ͘ͷ͔Λ͝ཧղ͍͚ͨͩͨͰ͠ΐ͏͔ʁ
  38.   (SBQI2-αʔόʔαΠυฤ (SBQI2-"1*αʔόʔ͸ͲͷΑ͏ʹ ࣮૷͢Ε͹Α͍ͷ͔ʁ

  39.   (SBQI2-αʔόʔαΠυࢹ఺ HSBQIRMSVCZ ͷ৔߹Ͱ͓࿩͍͖ͤͯͨͩ͞·͢

  40.   6TFS5ZQFͷఆٛ 6TFS5ZQF ฦ͞ΕΔܕ

  41.   6TFS5ZQFͷఆٛ $POOFDUJPO5ZQFʹ౉͞Εͨ Ҿ਺ʹԠͯ͡উखʹ-*.*5ͱ 0''4&5Λ͚ͭͯ͘ΕΔ ఆٛ ͱ 3FTPMWFS pFME໊

    ܕ આ໌ OVMMBCJMJUZΛએݴ͍ͯ͘͠
  42.   (SBQI2-αʔόʔαΠυࢹ఺ $POOFDUJPO5ZQFΛฦ͢ͱ͖ʹ ΄ͱΜͲͦΕΛҙࣝ͢Δඞཁ͕ͳͯ͘ૉ੖Β͍͠

  43.   6TFSRVFSZͷఆٛ VTFSRVFSZ

  44.   VTFSRVFSZͷ࣮૷ ฦ͢ܕ VTFSRVFSZͷҾ਺ ͜ͷRVFSZͰฦ͢ॲཧ 2VFSZ໊ʢ6TFSVTFSʹͳΔʣ

  45.   (SBQI2-αʔόʔαΠυࢹ఺ ͨͬͨ͜Ε͚ͩͰVTFSRVFSZ͕׬੒ ૝૾Ҏ্ʹ؆୯Ͱ͢ΑͶ☺ʁ

  46.   J04͔Β͸Ͳ͏ୟ͘ʁ J04͔Βୟ͘ͱ͖͸Ͳ͏͢Δͷ͔ʁ

  47.   J04͔Β͸Ͳ͏ୟ͘ʁ 1045Ͱ3FRVFTU#PEZʹԼهΛ౉͚ͩ͢

  48.   ੜ63-4FTTJPOͰؤுΔ

  49.   ੜ63-4FTTJPOͰؤுΔ ͜Ε͸πϥ͍

  50.   ͭΒ͍ͷͰ ϥΠϒϥϦͷྗΛआΓ͍ͨ

  51.   (SBQI2-ΫϥΠΞϯτϥΠϒϥϦ "QPMMPJ04 IUUQTHJUIVCDPNBQPMMPHSBQIRMBQPMMPJPT

  52.   "QPMMPJ04Λ࢖͏ɿԼ४උ "QPMMPJ04Λ࢖͏ͨΊʹ͸४උ͕ඞཁͰ͢

  53.   "QPMMPJ04Λ࢖͏ɿԼ४උ ίʔυੜ੒Λ͠·͢

  54.   "QPMMPJ04Λ࢖͏Լ४උ schema.json of Github GraphQL ͢΂ͯͷܕ2VFSZ.VUBUJPOT ৘ใ͕ॻ͔Ε͍ͯΔ findUser.gql

    (SBQIJ2-Ͱॻ͍ͨ 2VFSZΛϑΝΠϧͱͯ͠༻ҙ Apollo CLI Swift Code (FOFSBUF$PEF
  55.   "QPMMPJ04Λ࢖͏HRMϑΝΠϧ 2VFSZʹ໊લΛ͚ͭΔ

  56.   "QPMMPJ04Λ࢖͏ ܕͷ͋Δੈքʂ

  57.   J04͔Β(SBQI2-"1*Λୟ͘ "QPMMPJ04ͷྗΛआΓΕ͹ 5ZQF4BGFʹ(SBQI2-"1*Λୟ͘͜ͱ͕Ͱ͖Δ

  58. 42-ϥΠΫʹ͔͚Δ ඞཁͳσʔλ͚ͩΛճͰऔಘͰ͖Δ JOUFSGBDFʹܕ͕͋Δ 1BHJOBUJPOͷ࢓༷͕ܾΊΒΕ͍ͯΔ   (SBQI2-"1*ͷಛ௃(SBQI2-ͷັྗ ͜ΕΒ͕ͦͷ··(SBQI2-ͷັྗʹͳΔ

  59. w JOUFSGBDFʹܕ͕͋Δ w (SBQIJ2-͕࠷ߴ  ৗʹ࠷৽ͷυΩϡϝϯτʹͳ͍ͬͯΔ  ͍ͭͰ΋ࢼ͠ʹ"1*ୟ͚Δ͠ΫΤϦ࡞ΕΔ  

    J04ΞϓϦΤϯδχΞత(SBQI2-ͷخ͠Έ
  60. w ⭕ΫϥΠΞϯτຖʹ"1*࡞ΓΘ͚ͳͯ͘ྑָͯ͘ w ❌ը૾౳ͷϑΝΠϧΛσϑΥϧτͰ͸ѻ͑ͳ͍  ϑΝΠϧΛѻ͏Օॴ͚ͩ͸3&45GVMʹͯ͠ରॲ͍ͯ͠Δ  ʢϥΠϒϥϦΛೖΕΕ͹ѻ͑ͳ͘͸ͳ͍ʣ w ❌/

    ໰୊͕ൃੜ͠΍ͯ͘͢େม w ❌ΤϯυϙΠϯτ͕୯ҰʢBQJHSBQIRMʣͷͨΊ$BDIF೉͍͠  ͍··Ͱͷ஌ݟ͕͋·Γ࢖͑ͳ͍   αʔόʔαΠυࢹ఺Ͱ͸
  61.   (SBQI2-ͷπϥϛ ͯ͞ʜʜπϥϛͷ࿩Λ͠·͢

  62.   (SBQI2-ͷπϥϛ ΤϥʔϋϯυϦϯά͕೉͍͠

  63.   Τϥʔ͸Ͳ͏དྷΔͷ͔ Τϥʔ͸͜Μͳײ͡ͰདྷΔ

  64. w ෳ਺ͷ2VFSZ.VUBUJPOΛಉ࣌ʹୟ͘ͱҰ෦੒ޭͯ͠
 Ұ෦ࣦഊͱ͔͕ى͜Γ͏Δ w ͲΕ͕ΫϦςΟΧϧͳ΋ͷͳͷ͔ͷ൑அ͕ඞཁ   (SBQI2-ͷπϥϛɿΤϥʔϋϯυϦϯά ͍ͭ΋Ͳ͓Γؤுͬͯߟ͑ͯ΍Δ͔͠ͳ͍

  65.   (SBQI2-ͷπϥϛ TUBUVT$PEF͕جຊͰฦͬͯ͘Δ

  66. w TUBUVT$PEF͸جຊͰฦͬͯ͘Δ w (SBQI2-͸ϦΫΤετ͕௨Ε͹ w BQPMMPJPT͔Β͸TUBUVT$PEF͕ݟ͑ͳ͘ͳ͍ͬͯΔ w .VUBUJPOʢߋ৽ܥʣ͕ಛʹπϥ͍  

    (SBQI2-ͷπϥϛɿTUBUVT$PEF
  67. w (SBQI2-͸2VFSZ͕ͱͯ΋ັྗత͕ͩ.VUBUJPO͸ͦΕ΄Ͳ w ߋ৽ܥ͸(SBQI2-Ͱ͋Δ͋Γ͕ͨΈ͕΄ͱΜͲͳ͍   .VUBUJPOʹର͢Δ௒ݸਓతݟղ

  68.   ͜ͷπϥϛΛͳΜͱ͔ղܾͰ͖ͳ͍͔ͳ…ʁ (SBQI2-ͷπϥϛ

  69.   TUBUVT$PEF͕໰୊ ·ͣ(SBQI2-"1*ଆͰΤϥʔͷ಺༰Λ֦ு͢Δ

  70.   "1*ଆͰΤϥʔΛ֦ு͢Δ (SBQI2-"1*ଆͰΤϥʔΛ֦ுͯ͠ TUBUVT$PEFΛϨεϙϯεʹ෇༩͢Δ

  71.   ΞϓϦଆͰTUBUVT$PEFΛࢀর͢Δ TUBUVT$PEFΛऔΓग़͢

  72.   ͳΜͱ͔ͳͬͯΔؾ͕͢Δʜʁ TUBUVT$PEF͕໰୊

  73.   ͔͠͠ϫΠ͸ࢥͬͨ ʮ͍΍ϫΠ͸ɺ.VUBUJPOͷ݁Ռ͸ ී௨ʹ4UBUVT$PEFͰϋϯυϦϯά͍ͨ͠Μ͡Όʔʯ

  74.   ͔͠͠ϫΠ͸ࢥͬͨ ͳ͔ͥͱ͍͏ͱ

  75.   #BDLFOET'PS'SPOUFOET Payment Image/Movie Notification Core Domain (SBQI2- BFF

    iOS App ฐαʔϏε͸.JDSPTFSWJDFTߏ੒ 3&45GVM 3&45GVM 3&45GVM ͦ΋ͦ΋3&45GVM"1*΋ୟ͔ͳ͍ͱ͍͚ͳ͍͜ͱ͕͋Δ
  76.   #''Λ༻͍ͨࠇຐज़ J04͔ΒΈͯ.VUBUJPOʢߋ৽ܥʣ͚ͩ3&45ͬΆ͘ ৼΔ෣ΘͤΔ͜ͱ΋Ͱ͖·͢

  77.   GraphQL API BFF iOS App ᶄ (SBQI2-ͷ .VUBUJPOʹ

    Ϛοϐϯά ᶆ “errors”: [{ “statusCode”: 400 }] ᶇ FSSPSTpSTUTUBUVT$PEFΛ )5514UBUVT$PEFͱ͢Δ ᶈ )5514UBUVT$PEF ͰϋϯυϦϯά ᶃ 63-4FTTJPO౳Ͱ 1045BQJDSFBUF/PWFM #''Λ༻͍ͨࠇຐज़ ᶅ Mutation createNovel()
  78.   #''Λ༻͍ͨࠇຐज़ Ͱ͖·ͨ͠☺

  79.   #''Λ༻͍ͨࠇຐज़ ͜͏͍͏;͏ʹ΋Ͱ͖ΔΑ͍ͬͯ͏͚ͩͳͷͰ Φεεϝ͸͠·ͤΜ2 ΋͔ͨ͠͠Β͜Ε͕ΠΠͬͯͳΔ͜ͱ΋͋Δ͔΋ʜʁ

  80. w (SBQI2-͸ͳ͔ͳ͔͍͍ͧ  JOUFSGBDFʹܕ͕͋Δͷ࠷ߴ  (SBQIJ2-࠷ߴ w (SBQI2-͸ΤϥʔϋϯυϦϯά͕݁ߏΉ͔͍ͣͧ͠  #FTU1SBDUJDF͕͋·Γͳ͘ͱͯ΋೰·͍͠

      ·ͱΊ ࠙਌ձ΍ฐࣾ%F/"ϒʔεͰ΋͍ͭͰ΋͓੠͕͚͍ͩ͘͞ʂ
  81.   ࢀߟࢿྉ

  82. w BQPMMPΛOQNJOTUBMM  OQNJHBQPMMP w BQPMMPΛ࢖ͬͯ(JUIVC(SBQI2-"1*ͷTDIFNBΛऔಘ  BQPMMPTDIFNBEPXOMPBEFOEQPJOUIUUQTBQJHJUIVCDPNHSBQIRIFBEFS"VUIPSJ[BUJPO#FBSFSUPLFO TDIFNBKTPO w

    (SBQIJ2-Ͱॻ͍ͨRVFSZʹ໊લ͚ͭͯHRMϑΝΠϧͱͯ͠อଘ w TDIFNBͱHRM͔ΒBQPMMPΛ࢖ͬͯίʔυੜ੒  BQPMMPDPEFHFOHFOFSBUFRVFSJFTpOE6TFSHRMTDIFNBTDIFNBKTPO"1*TXJGU   "QPMMPJ04Λ࢖͏Լ४උʢৄࡉʣ