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

両OSやるマンという選択

 両OSやるマンという選択

iosdc2017

Ken Jumbo Haneda

September 16, 2017
Tweet

More Decks by Ken Jumbo Haneda

Other Decks in Programming

Transcript

  1. 3BSF+PCΞϓϦ J04 "OESPJE ։ൃݴޠ 4XJGU LPUMJO ։ൃ؀ڥ 9DPEF "OESPJE4UVEJP ΞʔΩςΫνϟ

    3Y4XJGU .77. 3Y+BWB .77. ओͳϥΠϒϥϦ 3Y4XJGU "1*,JU  )JNPUPLJ 3FBMN 3Y+BWB 3FUSpU 
 0L)551 3YCJOE Ξοϓσʔτස౓ গ ଟ Ϋϥογϡ গ ͪΐͬͱଟ ϨϏϡʔ   Ϣʔβʔൺ཰   ͦͯ͠1೥΄Ͳӡ༻ͯͨ݁͠Ռ
  2. 2016೥ͷϚʔέοτऩӹϥϯΩϯά - ΫΠζ ▪ iOS 1Ґ China 2Ґ Unites States

    3Ґ ??? Android
 1Ґ ??? 2Ґ United States 3Ґ South Korea Ҿ༻: https://www.appannie.com/jp/insights/market-data/app-annie-2016-retrospective/
  3. 2016೥ͷϚʔέοτऩӹϥϯΩϯά - ౴͑ ▪ iOS 1Ґ China 2Ґ Unites States

    3Ґ Japan Android
 1Ґ Japan 2Ґ United States 3Ґ South Korea Ҿ༻: https://www.appannie.com/jp/insights/market-data/app-annie-2016-retrospective/ ೔ຊ͸DL਺ͱऩӹֹ͕͍ۚۙਪҠͰ ಈ͍͍ͯΔɻ ୯ՁͰݟΔͱؖࠃͱ͔͸DL਺͕গͳׂ͍ʹ ऩӹֹ͕ଟ͍ͷͰ୯Ձ͕େ͖͍ɻ ଞࠃϦʔδϣϯ΁ͷల։Λ͍ͯ͠Δ ΞϓϦʹؔ܎͍ͯ͠Δਓ͸ͥͻAppAnnieͷ 2016೥ͷϨϙʔτΛݟ͍ͯͩ͘͞ɺ ௒໘ന͍Ͱ͢
  4. ͦΕͧΕͷϚʔέοτ Φεεϝهࣄ: https://growthhackjournal.com/app-store-optimization-tips-and-checklist-2017/ https://www.quora.com/Are-there-any-SEO-guides-for-mobile-apps-Google-Play-and-AppStore Google Play AppStore • ৹͕ࠪඞཁ •

    આ໌΍λΠτϧ΋৹ࠪ ඞཁ • εΫγϣ͸αΠζݻఆ • ϨΪϡϨʔγϣϯݫ͠ ͍ʢ”ແྉ”ͳͲ࢖͑ͳ ͍จݴʣ • ιʔγϟϧͳӨڹ͸ϥ ϯΩϯάʹߟྀ͞Εͳ ͍ • ετΞͷػೳΞοϓσʔ τ͸ͦ͜·Ͱසൟʹͳ ͍ • ৹͕ࠪෆཁ • ετΞͷ಺༰͸΄΅શͯ ABςετͰ͖Δ • εΫγϣ͸αΠζࢦఆॊೈ • ϨΪϡϨʔγϣ͸ൺֱతΏ Δ͍ • ιʔγϟϧͳӨڹ͸ϥϯΩ ϯάʹߟྀ͞ΕΔ • ετΞͷػೳΞοϓσʔτ ͕සൟͰศརͳػೳ͕ଟ͍
  5. σβΠϯ - ΨΠυϥΠϯ Ҿ༻: https://developer.apple.com/ios/human-interface-guidelines/overview/design-principles/ Three primary themes differentiate iOS

    from other platforms. • Clarity
 ໌ྎͰΔ͜ͱ • Deference ߇͑ΊͰ͋Δ͜ͱ • Depth Ԟߦ͖͕͋Δ͜ͱ

  6. σβΠϯ - ΨΠυϥΠϯ Ҿ༻: https://material.io/guidelines/#introduction-goals Material Design Principles. • Bold,

    graphic, intentional େ୾ʹɺੜ͖ੜ͖ͱɺҙਤతʹ • Motion provides meaning ಈ͖͸ҙຯΛఏڙ͢Δ • Material is the metaphor
 ϚςϦΞϧ͸ϝλϑΝʔͰ͋Δ 

  7. σβΠϯ - େ͖͞ͷදݱ ▪ iOS - px 
 pixel 


    σόΠεαΠζ͕ҟͳΔ࣌ʹpxࢦఆ σόΠεαΠζ͕ҟͳΔ࣌ʹdpࢦఆ dpiͷදݱ Android - dp
 density-independent pixels 
 (ີ౓ඇґଘϐΫηϧ) - dpi 
 dots per inch
 (ը໘ີ౓)
 1inchͷதͷdot਺
  8. σβΠϯ - ΞΠίϯͳͲͷඞཁͳը૾ ▪ iOS - Image Assets 
 2x/3x͕͋Ε͹͍͍ɺRetina

    = 2x/Plus = 3x 
 Android - dpi 
 hdpi, xhdpi, xxhdpi ͷ 3 छྨͷղ૾౓Ͱɺ
 ੈքͷશγΣΞͷ 8 ׂ Ҿ༻: https://developer.android.com/about/dashboards/index.html#Screens http://yuki312.blogspot.jp/2012/10/androidxhdpi.html
  9. σβΠϯ - ߏ੒ ▪ iOS - Navigation Controller/
 ViewController Classes

    
 ը໘Λදݱ͢ΔΫϥε͕ܾ·͍ͬͯΔɺ
 ContainerΛ࢖͍Viewίϯϙʔωϯτͱͯ͠΋
 ࢖͑Δ 
 Android - Activity - Fragment - View
 ϥΠϑαΠΫϧɺ࠶ར༻ੑɺ
 όοΫΩʔɺΩʔΠϕϯτɺ
 ςʔϚΛ͔࣋ͭͲ͏͔ͳͲ
 ҟͳΔ෦෼͕ଟ͍ ཧղ͢ΔͨΊͷΦεεϝهࣄ: https://www.slideshare.net/yanzm/droid-kaigi2015-yanzm
  10. σβΠϯ - ߏ੒ Android - Activity - Fragment - View


    
 ྆OS΍ΔϚϯʹͳΔʹ౰ͨͬͯ࠷ॳʹͭ·ͮ͘ϙΠϯτɻ
 
 
 Q. ݁ہͲΕͰը໘Λ࡞Δͷ͕͍͍ͷʁ
 A. ΈΜͳ͕ͪͬͯΈΜͳ͍͍ɻ ͭ·Γɾɾɾ
  11. σβΠϯ - ߏ੒ Android - Activity - Fragment - View


    
 A. ΄΅perfume. View Fragment Activity
  12. σβΠϯ - ߏ੒ Android - Activity - Fragment - View


    
 ͨͩͦΕͰ΋͋͑ͯݴ͏ͳΒ "ը໘֊૚ͷSPPUʹ͍ۙ΋ͷ΄Ͳ"DUJWJUZ'SBHNFOU7JFX
 ͭ·ΓJ04Ͱ͍͏.PEBMͱݺ͹Ε͍ͯͨ෦෼ʹ૬౰͢Δͱ͜ΖΛ
 "DUJWJUZͰදݱ͢Δͷ͕͏·͍͘͘
  13. ΫϩεϓϥοτϑΥʔϜͱ͍͏બ୒ࢶ ▪ ϏδωεαΠυࢹ఺ - ը໘ͷڞ௨։ൃͳͲ։ൃίετͷ࡟ݮ 
 ▪ ΤϯδχΞαΠυࢹ఺ - ࠷৽ͷωΠςΟϒAPI΁ͷར༻ݒ೦

    - αϙʔτ͕ා͍ - ࣮ࡍ׳Ε͍ͯΔݴޠͰ࡞ͬͨ΄͏͕ڞ௨Ͱ࡞ΔΑΓ
 ૣ͍ͷͰ͸ʁ - υΩϡϝϯτ͕ා͍ - ΩϟϦΞతʹා͍
  14. ڞ༗Ͱ͖Δ͜ͱͰ͖ͳ͍͜ͱ ڞ௨Խ Ͱ͖Δʁ ϝϞ σβΠϯ ✖ ϓϥοτϑΥʔϜͷσβΠϯΨΠ υϥΠϯʹै͍·͠ΐ͏ ઃܭɾΞʔΩςΫνϟ ˚

    ͋ͱͰ࿩͠·͢ ίʔυ ✖ 4XJGU,PUJO
 ม׵͸·ͩͰ͖ͳ͍ɾɾɾ $*$%ͳͲͷαʔϏε ˓ ͋ͱͰ࿩͠·͢ ετΞ؅ཧ ✖ ը૾΍εΫγϣͳͲඞཁͳ΋ͷ͕ ݁ߏҧ͏ ςετυΩϡϝϯτ ˚ ࠩҟΛ͚ͭͳ͍ͷͰ͋Ε͹͋Δఔ ౓ڞ௨ԽͰ͖Δ͸ͣ Ϣʔβʔମݧ ˚ σβΠϯ͕ҟͳΔͷͰɺΤϥʔද ه΍Ξχϝʔγϣϯ͸มΘΔ ΤσΟλ ˚ ͕Μ͹Ε͹WJNͱ͔Ͱ΋ॻ͚Δ͚ Ͳ݁ہϏϧυͱ͔Ͱඞཁ
  15. ࠷ۙͷXcodeͱAndroid Studioͷ৽ػೳ Xcode 9.0 Android Studio 2.3 ɾEmulatorͱͷΫϦοϓϘʔυڞ༗ ɾσΟʔϓϦϯΫͷ؅ཧػೳ ɾInstant

    RunͷΞοϓσʔτ ɾϏϧυΩϟογϡͷσϑΥϧτ༗ޮԽ ɾωοτϫʔΫܦ༝ͷΞϓϦసૹ ɾෳ਺ಉ࣌ͷγϛϡϨʔλʔىಈ ɾSwift4ରԠ ɾϏϧυߴ଎Խ
  16. ։ൃ؀ڥ 9DPEF "OESPJE4UVEJP ಋೖ ָ ͪΐͬͱෳࡶ Ϙλϯ গͳ͍ ΊͪΌΊͪΌଟ͍ ։ൃ؀ڥͱ


    ݴޠͷґଘ ڧ͍ɻ ͙͢όʔδϣϯ͋͛ͳ͍ͱ͍͚ͳ͍ ऑ͍ɻ ݁ߏલͷόʔδϣϯͰ΋ಈ͘ ύοέʔδɺϥΠϒϥϦ؅ ཧ DPDPBQPETDBSUIBHFͳͲ
 ֎෦ͷπʔϧ (SBEMF Ϗϧυ࣌ؒ ࣮૷ʹ΋ΑΔ͚Ͳ ॏ͘ͳΓ͕ͪ ࣮૷ʹ΋ΑΔ͚Ͳ
 ͋·Γॏ͍ҹ৅͸ͳ͍ ϨΠΞ΢τ؅ཧ 4UPSZCPBSE "VUP-BZPVU
 ৴ڼ৺͕ඞཁ 9.-
 ׂͱ$44ʹ͍ۙ ΤϛϡϨʔλʔͷ
 ࢖͍΍͢͞ γϯϓϧɺͦ΋ͦ΋σόΠεࣗମ͕
 γϯϓϧͩ͠؅ཧָ͕ ෳࡶͳ෦෼͕ଟ͍͕BECͰ
 $6*ܦ༝Ͱ؅ཧͰ͖Δ ϓϩδΣΫτ؅ཧ YDPEFQSPKYDXPSLTQBDFͳͲ
 ϓϩδΣΫτϑΝΠϧ͕࡞ΒΕγϯϓϧ ࣗ෼Ͱύεࢦఆͯ͠ىಈ͢Δɺ
 ؒҧ͑Δͱ͏·͘ಡΈࠐΊͳ͍ ϓϩδΣΫτ࡞੒࣌ߏ੒ ϓϩδΣΫτϑΝΠϧ͕΍΍͍͜͠ͱ͜Λ ͍͍ײ͡ʹݟͤͳ͍ͷͰΘ͔Γ΍͍͢ ͍͖ͳΓΘ͔Βͳ͍΋ͷ͕ͨ͘͞ Μੜ·ΕΔɻා͍ ˎओ؍ʹجͮ͘ൺֱ
  17. ։ൃ؀ڥ͝ͱʹϏϧυΛ෼͚Δ - iOS Build Configuration / Scheme, ͋ͱ͸ݹ͍΍ΓํͩͱTarget΍ϚΫϩͰ෼͚ΔͳͲ 1؀ڥ =

    1 Scheme
 = 1 Debug, 1 Release Build
 ιʔείʔυ಺ͰϚΫϩͰίʔυΛ෼͚Δ͜ͱ ͕ଟ͍.
  18. ։ൃ؀ڥ͝ͱʹϏϧυΛ෼͚Δ - Android Build Variant = Build Type ✖ Flavor

    1؀ڥ = 2 Build Variant
 = 1 Debug, 1 Release Build Type
 ιʔείʔυ͕Build Variant͝ͱʹ෼͚ΒΕ Δɻجຊ͸ڞ௨ͷ΋ͷɺ͋Ε͹؀ڥ͝ͱͷ΋ͷ Λ࢖͏ɻ Build VariantΛ੾Γସ͑ΔͱࣗಈͰͦΕʹԠͨ͡Ϧιʔε͕બ͹ΕΔ
  19. CI/CDΛͲ͏͢Δ͔ʁ $JSDMF$* #JUSJTF 8FSDLFS #VEEZ#VJME +FOLJOT ରԠ04 ྆04 ྆04 "OESPJEͷΈ

    ྆04 ྆04
 ʢ.BD04ͳΒʣ ࠷খϓϥϯ ྉۚ NP NP NP NP ࣗલ ແྉϓϥϯ
 ੍ݶ ͳ͠ Ϗϧυ͕࣌ؒ෼Ҏ ಺ɺϏϧυճ਺͸݄ ճ·Ͱͷ੍ݶ෇ ͖ Ϗϧυ࣌ؒ෼Ҏ ಺ɺ5SFMMP࿈ܞͳ͠ ࣗલ ઃఆํ๏ :".-8FC :.-8FC %PDLFS*NBHF ඞཁ 8FC ࣗલ ϝϞ ࢒೦ͳ͕Β༗ྉԽ Ϗϧυ͕࣌ؒҾ͔ͬ ͔Δ·Ͱ͸͜Ε࢖͑ ͹͍͍ͱࢥ͍·͢ɻ
 ઃఆָ͕ͳͷͰɻ ͪΐͬͱલʹྲྀߦͬͯ ͨΠϝʔδ ΩϡʔΠϯά͕݁ߏଟ ͍ɺٸʹ࣌ؒ଴ͪͱ ͔͋Δɻಠࣗͷϑϩʔ Ͱ$*ͳͲ͕ಈ͘ͷͰͱ ͖ͬͭʹ͍͘ҹ৅ɻ ਏ͍͚Ͳɺ΍ͬͺ֦ு ੑ͸Ұ൪͋ΔͷͰ "QQJVNͱ͔Ͱ6*ςε τ΋͍ͨ͠ਓͱ͔ɺ .BDͷ༨͍ͬͯΔਓ ͸͍͍͔΋
  20. ݕ౼ͷ຤ɺզ͕Ո͸Bitrise ઃఆ͸྆OS΍ͬͯ΋1೔ͰͰ͖Δͱࢥ͍·͢ɻ - YAML׳Εͯͳͯ͘΋ɺworkflowͰWeb্Ͱࢦఆͨ͠؀ڥม਺͔Β
 ੜ੒͢Δ͜ͱ΋Ͱ͖Δ - ഑෍ɺitunesconnect΁ͷΞοϓϩʔυ·ͰͰ͖Δ - iOSͷAutomatically Manage

    Signinઃఆ͍ͯ͠Δͱࣦഊ͢Δʢॿ͚ͯʣ - PlayStoreʹ্͛Δͷʹ͸Ұख͍ؒΔʢBeta൛ͰͰ͖ΔNowʂʣ - ͲͪΒͷOS΋؀ڥ͝ͱʹϏϧυͰ͖Δ͸ͣ CI/CDΛͲ͏͢Δ͔ʁ
  21. Enum // SwiftͱҟͳΔϙΠϯτ1. ෳ਺ͷॳظ஋ͷઃఆͱΞΫηε enum class Student(val firstName:String, val lastName:String,

    val age:Int){ STUDNET1(firstName = "tarou", lastName = "tanaka", age = 10), STUDNET2(firstName = "jirou", lastName = "suzuki", age = 12) } print(Student.STUDNET1.firstName) // tarou print(Student.STUDNET2.firstName) // jirou print(Student.STUDNET1.toString()) // STUDNET1 // SwiftͱҟͳΔϙΠϯτ2. ྻڍܕఆ਺ͷར༻ʹΑΓfilter΍foreach͕࢖͑Δ Student.values().forEach { student -> print(student.firstName) } kotlinʹ͓͚Δenum͸classͰ͋ΔͷͰɺෳ਺ͷॳظ஋Λ࣋ͬͨΓ
 Java४ڌͳͷͰͰ͖Δ͜ͱ͕ଟ͍˕ ࢀߟ: https://dogwood008.github.io/kotlin-web-site-ja/docs/reference/enum-classes.html
  22. म০ࢺ TXJGU LPUMJO PQFO Ϟδϡʔϧ͔֗ΒͷΞΫηεΛڐՄ ʢ4XJGU͔ΒͷΞΫηείϯτϩʔϧʣ ܧঝΛڐՄ͢Δ
 ʢpOBM͕σϑΥϧτͳͷͰඞཁʹԠ࣮ͯ͡૷ʣ QVCMJD ผϞδϡʔϧ͔ΒΞΫηεͰ͖Δ͕

    ܧঝɾΦʔόʔϥΠυͰ͖ͳ͍ ΞΫηεͰ͖ΔݶΓར༻Մೳ JOUFSOBM ಉ͡Ϟδϡʔϧ͔ΒΞΫηεͰ͖Δ ಉ͡Ϟδϡʔϧ͔ΒΞΫηεͰ͖Δ pMFQSJWBUF ಉ͡ιʔεϑΝΠϧ಺ͷΈΞΫηεͰ͖Δ  QSJWBUF ఆٛ͞Εͨείʔϓ಺ͷΈ ͦͷΫϥε಺͚ͩݟ͑Δ QSPUFDUFE  ͦͷΫϥεͱαϒΫϥε͔ΒͷΈݟ͑Δ pOBM ܧঝͰ͖ͳ͘ͳΔ ܧঝͰ͖ͳ͘ͳΔ ˎ஡৭͕σϑΥϧτ
  23. Swift to Kotlin Swift͔ΒkotlinͷίʔυΛ࡞ΔOSS https://github.com/angelolloqui/SwiftKotlin In fact, I explored an

    actual example using MVVM+Rx, where I got between a 50% and 90% of code similarity depending on the layer (non UIKit dependent is much more reusable than UIKit dependent classes of course). It took me around 30% the time to convert the Android version from the iOS version and I did not have SwiftKotlin then ;)