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

Introduction to Swift Deep Dive. #cm_osaka

Introduction to Swift Deep Dive. #cm_osaka

【10/26(金) 大阪】第2弾クラスメソッドのモバイル開発を知る!第1回〜iOS編

https://classmethod.connpass.com/event/104802/

808ce3d41280c085f8bdc27dce7ea8fb?s=128

Takaaki Tanaka

October 26, 2018
Tweet

Transcript

  1. Introduction to Swift Deep Dive.  ۚ  第2弾クラスメソッドのモバイル開発を知る!第1回〜iOS編

  2. "CPVUNF

  3. wΫϥεϝιουגࣜձࣾ w෱ԬΦϑΟεॴଐ wϞόΠϧΞϓϦαʔϏε෦ wϞόΠϧΞϓϦΤϯδχΞ wαʔόʔαΠυΞϓϦΤϯδχΞ wαʔόʔϨε։ൃ෦ wΞϓϦέʔγϣϯΤϯδχΞ ాத޹໌ @kongmingtrap

  4. ೥໨

  5. ೥໨

  6. ೥໨

  7. None
  8. ࣾ֎׆ಈ

  9. None
  10. ϚχΞοΫͳൃද͕͋ͬͨΓ͢ΔͷͰ ͦͷҰ෦Λ͝঺հͰ͖Ε͹ͱࢥ͍·͢

  11. w"#*ʹ͍ͭͯ w4*-ʹ͍ͭͯ wඇಉظॲཧʹ͍ͭͯ ࠓճ࿩͢͜ͱ

  12. "#*

  13. "QQMJDBUJPO#JOBSZ *OUFSGBDF 

  14. "QQMJDBUJPO#JOBSZ*OUFSGBDF wΦϒδΣΫτίʔυϨϕϧͷΠϯλʔϑΣʔ εΛࢦ͢ wޓ׵"#*Λαϙʔτ͢ΔγεςϜؒͰɺಉ͡ ࣮ߦϑΝΠϧΛมߋແ͠Ͱಈ࡞ͤ͞Δ࢓૊Έ

  15. None
  16. --7. wίϯύΠϧ࣌ɺϦϯΫ࣌ɺ࣮ߦ࣌ͳͲ͋ΒΏΔ ࣌఺ͰϓϩάϥϜΛ࠷దԽ͢ΔΑ͏ઃܭ͞Εͨ ίϯύΠϥج൫ wԾ૝ϚγϯΛλʔήοτͱͨ͠தؒίʔυ ʢϏοτίʔυʣΛੜ੒͠ɺͦͷԾ૝Ϛγϯ޲ ͚ίʔυΛಛఆͷϚγϯͷػցޠʹม׵͢Δ w4XJGUίϯύΠϥͷόοΫΤϯυʹར༻

  17. --7.Λܰྔͳ··ʹอͪଓ͚͍ͯΔେ͖ͳಛ௃ ͕͋Δ ϥΠϒϥϦΛ࢖͏ΫϥΠΞϯτଆ͔Βݟ Δͱࢍ൱྆࿦͕͋Δ ɻͦΕ͸ɺաڈͷܾஅ΋ੵۃ తʹݟ௚ͯ͠ɺաڈͱͷޓ׵ੑΛؾʹͤͣʹ"1* Λେ͖͘มߋ͍ͯ͘͠ͱ͍͏͜ͱͩɻ --7.ͷ఩ֶ 5IF"SDIJUFDUVSFPG0QFO4PVSDF"QQMJDBUJPOT೔ຊޠ༁

  18. 4XJGUͷ"#*͸ ҆ఆԽ͍ͯ͠ͳ͍

  19. None
  20. ʊਓਓਓਓਓਓਓਓਓʊ ʼɹ$POWFSU'BJMFEɹʻ ʉ:?:?:?:?:?:?:?:?:?ʉ

  21. IUUQTHJUIVCDPNBQQMFTXJGUCMPCNBTUFSEPDT"#*4UBCJMJUZ.BOJGFTUPNE 4XJGU"#*4UBCJMJUZ.BOJGFTUP

  22. 4XJGU"#*4UBCJMJUZ.BOJGFTUPΛಡΉ ࢀߟࢿྉ

  23. IUUQTHJUIVCDPNBQQMFTXJGUCMPCNBTUFSEPDT"#*4UBCJMJUZ.BOJGFTUPNE "#*҆ఆԽͷجຊํ਑ wΑΓ৽͍͠ίϯύΠϥ͕ݹ͍όʔδϣϯͷ4XJGUͰ ॻ͔ΕͨίʔυΛίϯύΠϧͰ͖Δ͜ͱ w৽͍͠4XJGUόʔδϣϯʹҠߦ͢Δࡍʹ4XJGU։ൃ ऀ͕௚໘͢ΔҠߦͷ௧ΈΛܰݮ͢Δ wιʔεͷޓ׵ੑʹΑΓɺύοέʔδ࡞੒ऀ͸ɺෳ਺ ͷ4XJGUόʔδϣϯʹΘͨͬͯ୯Ұͷίʔυϕʔε Λҡ࣋͠ͳ͕ΒɺϢʔβʔ͸৽͍͠όʔδϣϯͷ 4XJGUΛ࢖༻Ͱ͖ΔΑ͏ʹͳΔ

  24. IUUQTHJUIVCDPNBQQMFTXJGUCMPCNBTUFSEPDT"#*4UBCJMJUZ.BOJGFTUPNE "#*҆ఆԽͷجຊํ਑ wόΠφϦϑϨʔϜϫʔΫͱϥϯλΠϜͷޓ׵ੑ ʹΑΓɺෳ਺ͷ4XJGUόʔδϣϯͰಈ࡞͢Δό ΠφϦܗࣜͷϑϨʔϜϫʔΫΛ഑෍͢Δ wόΠφϦϑϨʔϜϫʔΫʹ͸ɺϑϨʔϜϫʔΫ ͷ"1*ͷιʔεϨϕϧͷ৘ใΛ఻ୡ͢Δ4XJGU ϞδϡʔϧϑΝΠϧͱɺ࣮ߦ࣌ʹϩʔυ͞ΕΔ ίϯύΠϧࡁΈͷ࣮૷Λఏڙ͢Δڞ༗ϥΠϒϥ Ϧͷ྆ํؚ͕·ΕΔ

  25. IUUQTHJUIVCDPNBQQMFTXJGUCMPCNBTUFSEPDT"#*4UBCJMJUZ.BOJGFTUPNE "#*҆ఆޙ w"#*҆ఆޙͷ҆ఆੑʹ͓͍ͯɺΑΓੵۃతͳϨΠ Ξ΢τվળ͕ൃ໌͞ΕΔՄೳੑ͕͋Γ·͢ɻͨͱ ͑͹ɺ֎෦λΠϓͷσʔλϝϯόʔΛ࢖༻ͯ͠ω ετ͞ΕͨλΠϓͷσʔλϝϯόʔΛฒ΂ସ͑ͨ ΓɺύοΩϯάͨ͠Γ͢Δ͜ͱ͕Ͱ͖·͢ɻͦͷ Α͏ͳվળ͸ɺల։λʔήοτ͓Αͼ·ͨ͸࠷খ όʔδϣϯνΣοΫΛհͯ͠"#*BEEJUJWFͳ΍Γ ํͰߦΘΕͳ͚Ε͹ͳΒͳ͍ɻ͜Ε͸ɺϞδϡʔ

    ϧϑΝΠϧ͕λΠϓ͝ͱͷ"#*όʔδϣϯ৘ใΛ τϥοΩϯά͢Δඞཁ͕͋Δ͜ͱΛҙຯ͠·͢ɻ
  26. "#*҆ఆޙ 4XJGU"#*4UBCJMJUZ.BOJGFTUPΛಡΉ

  27. "#*҆ఆޙ 4XJGU"#*4UBCJMJUZ.BOJGFTUPΛಡΉ

  28. "#*҆ఆԽ͸ඞਢཁ݅ wຊདྷ͸4XJGUͰऔΓೖΕΒΕΔ͸͕ͣॱԆ wίʔυΛอक͍ͯ͘͠ϓϩδΣΫτʹͱͬͯɺ ֎෦ϥΠϒϥϦͷϝϯςφϯεͷίετΛԼ ͛Δ͜ͱ͕Ͱ͖Δ w4XJGUͰͷ౥ࡌʹ޲͚ͯɺ4XJGUͳͲ Ͱ0XOFSTIJQपΓͷ੔උ͞Ε͍ͯΔ

  29. 4*-

  30. 4XJGU*OUFSNFEJBUF -BOHVBHF IUUQTHJUIVCDPNBQQMFTXJGUCMPCNBTUFSEPDT4*-STU

  31. w4XJGU︎︎︎︎︎︎︎︎︎︎︎︎︎︎︎︎ʹಛԽͨ͠ߴ౓ͳҙຯ৘ใΛ࣋ͭ 44" 4UBUJD4JOHMF"TTJHONFOU੩త ୯Ұ୅ೖ ܗࣜͷ*3 *OUFSNFEJBUF 3FQSFTFOUBUJPOதؒදݱ w࠷΋େ͖ͳػೳɾ໾ׂ͸࠷దԽ 4*-

  32. 4XJGUͷίϯύΠϧ IUUQMMWNPSHEFWNUHTMJEFT(SP⒎-BUUOFS4*-)JHI-FWFM*3QEG

  33. 4XJGUͷίϯύΠϧ 4XJGUίʔυ ߏจղੳ 4*- 0CKFDU 4*-ੜ੒ ҙຯղੳ ৄࡉղੳ --7.*3ੜ੒ --7.*3

    "45 ந৅ߏจ໦
  34. wιʔείʔυͷจࣈྻΛτʔΫϯʹ෼͚ʢࣈ ۟ղੳʣɺग़དྷΔݶΓม਺ͳͲͷࢀরΛղ ্ܾͨ͠Ͱ"45ʢந৅ߏจ໦ʣΛग़ྗ͢Δ ߏจղੳ

  35. wߏจղੳͰղܾͰ͖ͳ͔ͬͨม਺ͳͲͷࢀ রͷղܾɺϝϯόʔݺͼग़͠ͷղܾɺܕਪ࿦ɺ ܕνΣοΫΛߦ͏ ҙຯղੳ

  36. wҙຯղੳޙʹ--7.*3ʹམͱ͠ࠐΉͷͰ͸ ͳ͘ɺಠࣗͷதؒදݱͰ͋Δ4*-Λੜ੒͢Δ w4*-ͷੜ੒͸"45Λ૸ࠪͯ͠ߦΘΕΔ 4*-ੜ੒

  37. ֤޻ఔ͝ͱͷ݁Ռ͸ΦϓγϣϯͰࢦఆ IUUQTHJUIVCDPNLPOHNJOHTUSBQ4XJGU'J[[#V[[

  38. 4*-ʹग़ྗͯ͠ΈΔ TXJGUDFNJUTJMp[[CV[[TXJGU

  39. 4*-ʹग़ྗͯ͠ΈΔ

  40. 4*-ʹग़ྗͯ͠ΈΔ TXJGUDFNJUTJMp[[CV[[TXJGU

  41. 4*-ʹग़ྗͯ͠ΈΔ

  42. wࣗ෼͕ॻ͍ͨίʔυ͕ͲͷΑ͏ʹॲཧ͞Ε ͍ͯ͘ͷ͔Λ஌Δ͜ͱ͕Ͱ͖Δ wύϑΥʔϚϯεվળͷࡍʹٞ࿦ͷωλʹͳ Δ ίϯύΠϧͷ݁ՌΛಡΉ͜ͱʹΑͬͯ

  43. <1%'>4XJGU*OUFSNFEJBUF-BOHVBHF.FNPSZ1SPNPUJPO IUUQTLJUBTVLFCPPUIQNJUFNT

  44. ඇಉظॲཧ

  45. IUUQTHJTUHJUIVCDPNMBUUOFSCGCEDGD "TZOD"XBJUGPS4XJGU

  46. ඇಉظॲཧͰ ؕΓ͕ͪͳ໰୊ͨͪ

  47. ӡ໋ͷϐϥϛου

  48. ӡ໋ͷϐϥϛου ୯७ͳγʔέϯεॲཧΛΫϩʔδϟͰܨ͛ ͯ͠·͏ͱɺਂ͍ωετ͕ൃੜ͠ɺϐϥϛο υͷΑ͏ͳ֊૚ʹͳͬͯ͠·͏

  49. ΤϥʔϋϯυϦϯά

  50. ΤϥʔϋϯυϦϯά Τϥʔॲཧͷهड़͕৑௕ʹͳΔ ʢίʔϧόοΫϕʔεͷ৔߹ʣ

  51. $PNQMFUJPO)BOEMFSͷ࢖͍Ͳ͜Ζ

  52. $PNQMFUJPO)BOEMFSͷ࢖͍Ͳ͜Ζ ඇಉظ"1*Λఆٛ͠ʢ$PNQMFUJPO)BOEMFSΛ࢖༻ʣɺଟ ͘ͷ"1*ΛϒϩοΫ͢Δ͜ͱ͕Ͱ͖ͨͱͯ͠΋ɺ6*͕བྷΉ ෦෼͸ಉظͰ΍Β͟ΔΛಘͳ͍

  53. wඇಉظॲཧͷߏจ wॱ൪ʹ݁Ռ͕ඞཁͳඇಉظॲཧΛهड़ w༷ʑͳݴޠʹΤοηϯε͕औΓࠐ·Ε͍ͯ Δ w'VUVSF1SPNJTFͩͱ൥ࡶʹͳΔ৔߹ͷه ड़ΛΑΓ؆ܿʹͰ͖ΔΑ͏ʹͨ͠ ͦ΋ͦ΋"TZOD"XBJUͱ͸

  54. wඇಉظॲཧͷ࠷ऴతͳ׬ྃ΋͘͠͸ࣦഊΛ ද͢৔߹ɺॻ͖ํʹΑͬͯ͸൥ࡶʹͳΔ 1SPNJTF doSomething().then(function(result) { return doSomethingElse(result); }) .then(function(newResult) {

    return doThirdThing(newResult); }) .then(function(finalResult) { console.log('Got the final result: ' + finalResult); }) .catch(failureCallback);
  55. "TZOD"XBJUGPS4XJGU 4XJGUͷ"TZOD

  56. "TZOD"XBJUGPS4XJGU 4XJGUͷ"TZOD

  57. "TZOD"XBJUGPS4XJGU 4XJGUͷ"TZOD "TZODͷࢦఆͰ໭Γ஋͕ඇಉظ Ͱฦ͞ΕΔ͜ͱΛࣔ͢

  58. "TZOD"XBJUGPS4XJGU 4XJGUͷ"XBJU

  59. "TZOD"XBJUGPS4XJGU 4XJGUͷ"XBJU

  60. "TZOD"XBJUGPS4XJGU 4XJGUͷ"XBJU

  61. "TZOD"XBJUGPS4XJGU 4XJGUͷ"XBJU ඇಉظॲཧͷ݁Ռ͕ฦͬͯ͘Δ ·Ͱ଴ػͤ͞Δ

  62. "TZOD"XBJUGPS4XJGU #FGPSF

  63. "TZOD"XBJUGPS4XJGU "GUFS

  64. ͞ΒͳΔԠ༻

  65. w4DBMBͰ͸͓ͳ͡Έͷܕ wऴ͍ྃͯ͠Δ͔Ͳ͏͔Θ͔Βͳ͍ॲཧ݁Ռ Λந৅Խͨ͠ܕ w'VUVSF͸ະདྷͷ݁ՌΛද͢ܕ 'VUVSF

  66. val f: Future[List[String]] = Future { session.getRecentPosts } f onFailure

    { case t => println("エラーが発⽣生した: " + t.getMessage) } f onSuccess { case posts => for (post <- posts) println(post) } 'VUVSF
  67. "TZOD"XBJUGPS4XJGU 'VUVSFΛ4XJGUͰ࣮ݱ

  68. 'VUVSFΛ4XJGUͰ࣮ݱ "TZOD"XBJUGPS4XJGU

  69. w4XJGUͷݴޠ։ൃऀͳΒͰ͸ͷࢹ఺Ͱɺඇಉ ظॲཧʹؔ͢ΔΞϓϩʔν͕هࡌ͞Ε͍ͯΔ wϓϩϙʔβϧͱ͸΂ͭʹ'VUVSFܕʹ͍ͭͯ ͷ࣮૷ྫ͕هࡌ͞Ε͍ͯΔ "TZOD"XBJUGPS4XJGUͷϓϩϙʔβϧ

  70. ॴײ

  71. w4XJGUͷൃల͸௥ָ͍͍ͬͯͯ͠ wݴޠͷίϛϡχςΟ͸ɺͨ·ʹϚχΞοΫ ͳ࿩୊͕Ͱ͖ͯͨΓ͢ΔͷͰୀ۶͠ͳ͍ wJ04NBD04Ҏ֎Ͱ΋4XJGUͷ׆༂ͷ৔͕ ޿͕ͬͯཉ͍͠ ॴײ

  72. w"#*҆ఆԽʹ͍ͭͯ w4XJGU*OUFSNFEJBUF-BOHVBHF.FNPSZ 1SPNPUJPO w4XJGUͰࣗ࡞ίϯύΠϥΛ࡞ͬͨ࿩ w4XJGU"#*4UBCJMJUZ.BOJGFTUPΛಡΉ w4XJGUͷதؒݴޠ4*-ΛಡΉͦͷ4*-ʹೖ໳ ͢ΔͨΊͷ४උ ࢀߟจݙ

  73. એ఻

  74. ͔͔ͤͬͩ͘Β ෱Ԭʹߦͬͯ 4XJGUͰϫΠϫΠ ΍Γ͍ͨ

  75. None
  76. ͦͷΠϕϯτ୯ମͩͱ ݫ͍͠ํ͸ʜ

  77. None
  78. 4XJGU΋ςετ΋ ໘ന͍ʂ ΋ͬͱ৭ʑͳݴޠͷ ษڧΛ͍ͨ͠ʜ

  79. None
  80. ͋Γ͕ͱ͏͍͟͝·ͨ͠