「iOSエンジニアだし、Androidアプリも作れるでしょ?」

9d1961575e45a8286cdde5f86dbba312?s=47 akatsuki174
September 20, 2020

 「iOSエンジニアだし、Androidアプリも作れるでしょ?」

2020/09/20 iOSDC Japan 2020 day 1

9d1961575e45a8286cdde5f86dbba312?s=128

akatsuki174

September 20, 2020
Tweet

Transcript

  1. ʮiOSΤϯδχΞͩ͠ɺ AndroidΞϓϦ΋ ࡞ΕΔͰ͠ΐʁʯ iOSDC Japan 2020 @akatsuki174

  2. ࣗݾ঺հ

  3. • ਢ౻ຘʢ@akatsuki174ʣ • iOS→AndroidΤϯδχΞ • גࣜձࣾTimersॴଐ • ࠷ۙiOS΋࢓ࣄͰ΍ͬͯΔ • Α͘࢖ͬͯΔ୺຤͸ɺiPhone

    Xͱ Pixel 3 • iOSDC Japan 2020 core staff
  4. ࠓ೔ͷ࿩

  5. ໨࣍ • iOS/AndroidͷUIͰҧ͏ͱ͜Ζ • Swiftͱൺֱͭͭ͠KotlinΛֶ΅͏ • ActivityɺFragmentΛཧղ͠Α͏ • Α͘࢖͏ListViewͱRecyclerViewΛ஌Ζ͏ •

    ؆୯ͳUI͕૊ΊΔΑ͏ʹͳΖ͏ • ࠷௿ݶͷσόοά͕Ͱ͖ΔΑ͏ʹͳΖ͏
  6. ͳΜͱͳ͘Ͱ͖ΔΑ͏ʹͳΔ͜ͱ • iOS/Androidͷҧ͍͕Θ͔Δ • Kotlinίʔυ͕ಡΊΔΑ͏ʹͳΔ • AndroidΞϓϦͷ࡞Γํ͕Θ͔Δ • ෆ۩߹ͷಛఆ͕Ͱ͖ΔΑ͏ʹͳΔ

  7. ࠓ೔ͷࢿྉ

  8. ࠓ೔ͷࢿྉ • SpeakerDeckʹ্͛ͯ·͢ • TwitterͰྲྀͯ͠·͢

  9. iOS/AndroidͷUIͰ ҧ͏ͱ͜Ζ

  10. ࣅͯΔ͚Ͳɺҧ͏ • iOS/AndroidͰࣅͯΔ΋ͷʹ͍ͭͯઆ໌ • ࣅͯͯ΋ࡉ෦͕ҟͳ͍ͬͯͨΓ͢ΔͷͰ҆қ ʹஔ͖׵͑ΒΕͳ͍͜ͱ΋

  11. ը໘ભҠ • iOS • ϓογϡભҠ͕ج࣠ɻ֊૚Λ۷ΔΠϝʔδɻ • ঢ়گʹΑͬͯɺϞʔμϧભҠ • Android •

    ϖʔδΛੵΈॏͶΔΠϝʔδɻ
  12. ໭ΔϘλϯͷ༗ແ • iOS • ΄΅ඞ͍͍ͣͭͯΔ • Android • ͍ͭͯͳ͍͜ͱ΋͋Δ •

    ୺຤ʹ໭ΔϘλϯ͕͋Δ
  13. J04 "OESPJE

  14. ը໘λΠτϧͷҐஔ • iOS • தԝ • ϥʔδλΠτϧͩͱࠨ୺ • Android •

    ࠨ୺
  15. J04 "OESPJE

  16. ཁૉબ୒ • iOS • ϦετɺυϥϜϩʔϧɺΞΫγϣϯγʔτ • Android • νΣοΫϘοΫεɺϥδΦϘλϯɺυϩοϓ μ΢ϯϦετɺϘτϜγʔτ

  17. J04 "OESPJE

  18. Ϧετͷ໼ҹ • iOS • Disclosure IndicatorΛ෇͚ͨΓ͢Δ • Android • ෇͚ͳ͍ํ͕Ұൠతʁ

  19. J04 "OESPJE

  20. ೔෇બ୒ • iOS • υϥϜϩʔϧ • iOS 14͔Β͸ΧϨϯμʔܕ΋ • Android

    • ΧϨϯμʔܕ
  21. "OESPJE J04

  22. ϑϩʔςΟϯάΞΫγϣϯϘλϯ • ͦͷը໘ͷओΞΫγϣϯϘλϯ • iOSͰ΋࢖͍ͬͯΔྫ΋ͪΒ΄Β

  23. None
  24. γϟυ΢ • ϚςϦΞϧσβΠϯʹӨͷষ͕͋Δ • Z࣠ɺಈ͖ͷํ޲Λ஌֮ͤ͞Δ • Өͷೱ͞͸ߴ͞ɺଞͱͷؔ܎ʹΑܾͬͯ·Δ

  25. https://material.io/design/environment/light-shadows.html#shadows ᶃ ᶄ ᶅ

  26. φϏήʔγϣϯυϩϫʔ • iOS • كʹͦΕͬΆ͍ͷ͕͋Δ • Android • ը໘ࠨ͔ΒεϥΠυͯ͠දࣔͰ͖Δϝχϡʔ

  27. None
  28. ࢀߟʹͳΔαΠτ • consim • iOS/Androidͷը໘ΛൺֱͰ͖ΔαΠτ • https://consim.design/ • ʮAndroid͸iOSͱಉ͡σβΠϯͰʂʯͱݴΘΕͨͱ͖ͷ ରԠҊ

    • https://qiita.com/ogapants/items/ 8a551ed3b16bcf0cc3ed
  29. Swiftͱൺֱͭͭ͠ KotlinΛֶ΅͏

  30. Kotlinͱ͸ • JetBrains͕։ൃͨ͠ΦϒδΣΫτࢦ޲ɹɹɹ ϓϩάϥϛϯάݴޠ • Google I/O 2017ͰAndroidνʔϜ͕KotlinΛ ެࣜʹαϙʔτ͢Δ͜ͱΛൃද •

    Javaͷࢿ࢈ͷଟ͘Λྲྀ༻Ͱ͖Δ • 1ͭͷϓϩδΣΫτʹJavaͱKotlinͷࠞࡏՄ
  31. KotlinͱSwift • ΘΓͱॻ͖ํ͕ࣅͯΔ • جຊจ๏Ͱࣅ͍ͯΔ΋ͷΛ঺հ

  32. ϓϩύςΟએݴ

  33. Φϓγϣφϧ

  34. Ξϯϥοϓ

  35. ؔ਺

  36. ഑ྻૢ࡞

  37. Ϋϥε֦ு

  38. ΠϯλʔϑΣʔεɺϓϩτίϧ

  39. ͦͷଞ

  40. ActivityɺFragmentΛ ཧղ͠Α͏

  41. ActivityͱFragment • MVCͰݴ͏ͱ͜ΖͷControllerΈ͍ͨͳ΋ͷ • ϥΠϑαΠΫϧΛ͍࣋ͬͯΔ

  42. Activityͱ͸ • ௨ৗɺ1ͭͷActivityͰ1ͭͷը໘Λ࣮૷͢Δ • ≒ UIViewController

  43. https://developer.android.com/guide/components/ activities/activity-lifecycle?hl=ja

  44. "DUJWJUZ ੜ੒࣌ "DUJWJUZ͔Β཭ΕΑ ͏ͱ͍ͯ͠ΔɻӬଓԽॲཧ ͸͜͜Ͱɻ Ϣʔβ͕ΠϯλϥΫ γϣϯΛ࣮ࢪͰ͖Δঢ়ଶ "DUJWJUZ͕ ݟ͑ͳ͘ͳͬͨͱ͖ https://developer.android.com/guide/components/

    activities/activity-lifecycle?hl=ja
  45. ActivityͷϨΠΞ΢τ • Activity#onCreate(Bundle)ͷதͰ Activity#setContentView(int)Λݺͼग़͢ • int͸ϨΠΞ΢τϑΝΠϧͷid

  46. Fragmentͱ͸ • Activityʹ૊ΈࠐΜͰ࢖͏ • 1ͭͷActivityʹෳ਺ͷFragmentΛ૊Έ߹Θͤɹ ΒΕΔ • ଟղ૾౓ରԠ࣌ʹศར • ෳ਺ͷActivityͰFragmentΛ࠶ར༻Ͱ͖Δ

  47. https://developer.android.com/guide/ components/fragments?hl=ja#Creating

  48. https://developer.android.com/guide/ components/fragments?hl=ja#Creating 'SBHNFOU͕ "DUJWJUZʹ ૊Έࠐ·Εͨঢ়ଶ 'SBHNFOU ͕࣋ͭ 7JFXΛߏங 'SBHNFOU ͕"DUJWJUZ͔Β

    ੾Γ཭͞ΕΔ
  49. https://developer.android.com/guide/components/fragments?hl=ja#Design

  50. Α͘࢖͏ListViewͱ RecyclerViewΛ஌Ζ͏

  51. ListViewͱ͸ • Androidͷॳظ͔Β༻ҙ͞Ε͍ͯΔΫϥε • γϯϓϧͳҰཡදࣔ

  52. ొ৔ਓ෺ͷΠϝʔδ %BUB4PVSDF "EBQUFS -JTU7JFX $VSTPS "SSBZ-JTU FUD

  53. ListViewʢ࣮૷ʣ

  54. ListViewʢϨΠΞ΢τʣ

  55. RecyclerViewͱ͸ • ListViewΛ֦ுͯ͠ॊೈੑΛ΋ͨͤͨվྑ൛ • εϫΠϓɺD&DͳͲΛ͢ΔͳΒͬͪ͜ • ϔομʔɺϑολʔͷ࢓૊Έ͸ଘࡏ͠ͳ͍ • ۠੾Γઢ͸ࣗ෼Ͱ࣮૷͢Δඞཁ͕͋Δ

  56. ొ৔ਓ෺ͷΠϝʔδ %BUB4PVSDF "EBQUFS 7JFX)PMEFS 3FDZDMFS7JFX -BZPVU.BOBHFS

  57. RecyclerViewʢຊମʣ

  58. RecyclerViewʢAdapterʣ

  59. RecyclerViewʢViewHolderʣ

  60. RecyclerViewʢϨΠΞ΢τʣ

  61. RecyclerViewʢϨΠΞ΢τʣ

  62. ؆୯ͳUI͕ ૊ΊΔΑ͏ʹͳΖ͏

  63. AndroidͷϨΠΞ΢τͷ࡞Γํ • xmlͰ௚઀هड़ɺ΋͘͠͸GUIͰ࡞੒ ʢStoryboard, xibΈ͍ͨͳ͔Μ͡ʣ • ͍ͣΕʹͯ͠΋xml͕ੜ੒͞ΕΔ

  64. None
  65. None
  66. None
  67. LayoutsͱWidgets • LayoutͰ࿮Λࢦఆ͠ɺ෦඼ͱͳΔWidgetΛɹ ฒ΂͍ͯ͘ • Widgetʹ͸Button, ImageView, TextView, ListViewͳͲ͕͋Δ

  68. -BZPVU 8JEHFU -BZPVU

  69. ͞·͟·ͳϓϩύςΟ • LayoutɺWidget͸iOSͱಉ͡Α͏ʹɺ༷ʑͳɹ ઃఆΛՃ͑Δ͜ͱ͕Ͱ͖Δ • ΋ͪΖΜLayout/WidgetʹΑͬͯઃఆͰ͖Δɹ ϓϩύςΟ͸ҟͳΔ • ͜͜Ͱ͸୅දతͳ΋ͷΛ঺հ

  70. id • ݴ༿௨Γɺࣝผࢠ • ಉҰϑΝΠϧ಺ͰҰҙͳ໊લʹͳ͍ͬͯΕ͹ɹ ྑ͍ • xmlͰৼͬͨidΛݩʹKotlinϑΝΠϧ͔Βݺͼɹ ग़͕͠Ͱ͖Δ

  71. None
  72. None
  73. width/height • ݴ༿௨Γɺ෯ͱߴ͞ • `match_parent`ͩͱ਌ͷViewʹର͍ͯͬ͠ͺ͍ ʹ޿͕Δ • `wrap_content`͸಺༰ʹ߹Θͤͯௐઅ͞ΕΔ • ΋ͪΖΜઈର஋ࢦఆ΋Մ

  74. None
  75. ओͳLayoutͷछྨ • LinearLayout • ॎorԣ1ྻʹཁૉΛฒ΂Δ • UIStackViewͬΆ͍͔Μ͡ • ConstraintLayout •

    ཁૉʹ੍໿Λ෇͚ɺҐஔΛ૬ରతʹܾΊΔ
  76. None
  77. None
  78. None
  79. None
  80. None
  81. ͓·͚ɿϓϨϏϡʔTips

  82. ༨ஊɿJetpack Compose • Google I/O 2019Ͱൃද͞ΕͨɺUIπʔϧΩοτ • SwiftUIͷΑ͏ʹɺએݴతʹUIΛߏஙͰ͖Δ

  83. https://developer.android.com/jetpack/compose?hl=ja

  84. ࠷௿ݶͷσόοά͕ Ͱ͖ΔΑ͏ʹͳΖ͏

  85. 2௨Γ঺հ • ϒϨʔΫϙΠϯτΛுΔํ๏ • Ϗϡʔ֊૚Λ೺Ѳ͢Δํ๏

  86. ϒϨʔΫϙΠϯτͷுΓํ

  87. None
  88. None
  89. None
  90. ͜Μͳέʔε͋Γ·ͤΜ͔ʁ • RecyclerViewͷpositionͳͲɺมΘΓΏ͘஋Λ ೺Ѳ͍ͨ͠ • ͍͍ͪͪϒϨʔΫϙΠϯτͰࢭ·ͬͯ΄͘͠ɹ ͳ͍ • ίʔυʹLog.dॻ͍ͯ࠶Ϗϧυ͢Δͷ΋໘౗

  91. ղܾͰ͖·͢ • Evaluate and logΛ׆༻͢Ε͹࠶Ϗϧυͤͣɹ ϩάΛग़ྗͰ͖Δ • ίʔυ΋͍͡Δඞཁ͕ͳ͍

  92. None
  93. None
  94. None
  95. Ϗϡʔ֊૚ͷݟํ • Layout InspectorΛ࢖͏

  96. None
  97. ·ͱΊ

  98. ·ͱΊ • iOSͷੈքΛ஌͍ͬͯΕ͹Android΋ͦ͜·Ͱɹ ೉͘͠ͳ͍ʂʂʂ

  99. એ఻

  100. • αʔόʔαΠυΤϯδχΞ (PHP, Golang, AWS) • AndroidΤϯδχΞ (Kotlin) • iOSΤϯδχΞ

    (Swift) TimersͰ͸ݱࡏΤϯδχΞશ৬छ࠾༻தʂ ৄ͘͠͸”Timers”Ͱݕࡧ
  101. ͝ਗ਼ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ