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

Cookpad TechConf 2019 〜霞が関〜 クックパッドiOSアプリの 破壊と創造、そして未来

giginet
February 27, 2019

Cookpad TechConf 2019 〜霞が関〜 クックパッドiOSアプリの 破壊と創造、そして未来

giginet

February 27, 2019
Tweet

More Decks by giginet

Other Decks in Technology

Transcript

  1. @giginet
    ϞόΠϧج൫෦
    ʙբ͕ؔʙ
    ΫοΫύουiOSΞϓϦͷ
    ഁյͱ૑଄ɺͦͯ͠ະདྷ

    View full-size slide

  2. 2
    ࠷ॳͷίϛοτ ೥݄
    ݱࡏ·Ͱͷίϛοτ
    ϦϦʔεස౓ िճ
    ϦϦʔεลΓͷ։ൃऀ਺ d
    ૯ίʔυߦ਺
    ˞ݱࡏͷίʔυϕʔεʹҠߦޙ

    View full-size slide

  3. 3
    ։ൃऀ͝ͱͷ1೔ͷྦྷੵϏϧυ࣌ؒ
    1h
    1.5h

    View full-size slide

  4. 4
    27%
    73%
    155,000ߦ
    58,700 ߦ
    Objective-C
    Swift

    View full-size slide

  5. ՝୊
    5
    •1೔ྦྷੵ1࣌ؒ/ਓΛ্ճΔϏϧυ࣌ؒ
    •ࠓͳ͓25%͋ΔObjective-C
    •ϝϯς͞Εͯͳ͍ػೳ
    •ີ݁߹ա͗ͯͲ͔͜ม͑ΔͱյΕΔ

    View full-size slide

  6. 6
    բ͕ؔ
    IUUQTKBXJLJQFEJBPSHXJLJ&##%&#$"&"%#&#"#&"

    View full-size slide

  7. բ͕ؔͷ໨త
    7
    •ίʔυ੔ཧ
    •Objective-Cͷഁյ
    •Ϗϧυ࣌ؒͷվળ

    View full-size slide

  8. ཧ૝
    8
    .PEVMFT %ZOBNJD'SBNFXPSL

    "QQMJDBUJPO

    View full-size slide

  9. ϚϧνϞδϡʔϧԽ
    10
    •Ωϟογϡ͕ޮ͖ɺ։ൃ࣌ͷϏϧυߴ଎Խ
    •ݹ͍࣮૷ͷӅṭ
    •ը໘ؒΛૄ݁߹ʹͰ͖Δ

    View full-size slide

  10. Objective-C Bridging
    11
    11
    MyApp-Bridging-Header.h
    MyApp-Swift.h

    View full-size slide

  11. բ͕ؔͷΰʔϧ
    12
    •։ൃऀͷखݩͷϏϧυ࣌ؒΛ1೔30෼Ҏ಺ʹೲΊΔ
    •Objective-CΛ׬શʹফ͠ڈΔ

    View full-size slide

  12. ։ൃऀͷੜ࢈ੑΛ
    ͳΜͱ͔͢Δͷ͕
    բ͕ؔ

    View full-size slide

  13. View
    Model
    ViewController

    View full-size slide

  14. 15
    View
    Model
    ViewController
    ϩδοΫΛ࣋ͭ7JFX
    XXXManager
    γϯάϧτϯͷσʔλιʔε
    .BTTJWF7JFX$POUSPMMFS
    ڞ௨Խ͞ΕͯංେԽͨ͠Ϟσϧ

    σουίʔυ
    ີ݁߹
    7JFXͷܧঝɺ࢖͍ճ͠

    ৮ͬͯ͸
    ͍͚ͳ͍΍ͭ

    ࠞಱ

    View full-size slide

  15. DataStore
    UseCase
    Presenter
    ViewBuilder
    View
    Wireframe
    Entity
    DataStore
    Entity
    UseCase
    Interactor
    Presentation Layer Domain Layer
    Data Layer
    Repository
    $PPLQBE7*1&3

    View full-size slide

  16. 17
    Tsukuru
    Cookpad

    7*1&3ԽҎલͷ.7$
    0CKFDUJWF$4XJGUͷࠞࡏ
    7*1&3Խޙͷը໘ͷू߹
    4XJGU
    ɾɾɾ
    ࠞಱ
    Cookpad

    View full-size slide

  17. 18
    Tsukuru
    Cookpad

    7*1&3ԽҎલͷ.7$
    0CKFDUJWF$4XJGUͷࠞࡏ
    7*1&3Խޙͷը໘ͷू߹
    4XJGU
    ɾɾɾ
    7*1&3ΞϓϦέʔγϣϯ
    Cookpad

    View full-size slide

  18. طଘͷΞʔΩςΫνϟΛ
    ੜ͔ͨ͠
    ϚϧνϞδϡʔϧԽ

    View full-size slide

  19. 21
    YAML
    yonaskolb/XcodeGen
    ࣗಈੜ੒

    View full-size slide

  20. 22
    ৽نλʔήοτ

    View full-size slide

  21. 23
    targets:
    CookpadCore:
    type: framework
    platform: iOS
    sources:
    - CookpadCore
    settings:
    base:
    PRODUCT_BUNDLE_IDENTIFIER: com.cookpad.CookpadCore
    scheme:
    testTargets:
    - CookpadCoreTests
    dependencies:
    - sdk: Foundation.framework
    - carthage: Result
    - carthage: RxCocoa
    - carthage: RxSwift

    View full-size slide

  22. 24
    σΟϨΫτϦߏ଄ʹΑΓ
    ॴଐ͢ΔϏϧυλʔήοτ͕
    อূ͞ΕΔ

    View full-size slide

  23. xcodeprojΛഁյͨ͠Β
    Ϟδϡʔϧಋೖ͕༰қʹ

    View full-size slide

  24. ϚϧνϞδϡʔϧͷ
    ಋೖ
    26

    View full-size slide

  25. բ͕ؔͷίϯηϓτ
    27
    •େ͖ͳॻ͖׵͑Λڧ੍͠ͳ͍
    •Objective-CΛ࣋ͪࠐ·ͤͳ͍
    •࣮૷ৄࡉ͸VIPERΞϓϦέʔγϣϯʹӅṭ

    View full-size slide

  26. բ͕ؔͷίϯηϓτ
    28
    •େ͖ͳॻ͖׵͑Λڧ੍͠ͳ͍
    •Objective-CΛ࣋ͪࠐ·ͤͳ͍
    •࣮૷ৄࡉ͸VIPERΞϓϦέʔγϣϯʹӅṭ

    View full-size slide

  27. բ͕ؔͷίϯηϓτ
    29
    •େ͖ͳॻ͖׵͑Λڧ੍͠ͳ͍
    •Objective-CΛ࣋ͪࠐ·ͤͳ͍
    •࣮૷ৄࡉ͸VIPERΞϓϦέʔγϣϯʹӅṭ

    View full-size slide

  28. 30
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    View full-size slide

  29. 31
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    View full-size slide

  30. 32
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    View full-size slide

  31. 33
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    View full-size slide

  32. 34
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    View full-size slide

  33. 35
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    ந৅౓

    View full-size slide

  34. 36
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    Environment
    ۩ମతͳ࣮૷
    ΠϯλʔϑΣΠεͷΈΛఏڙ

    View full-size slide

  35. 37
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    Environment
    բ͕ؔήʔτ΢ΣΠ

    View full-size slide

  36. 38
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    Bridging HeaderΛ
    ࣋ͨͳ͍

    View full-size slide

  37. 39
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    Objective-C Bridge͸
    ΞϓϦͰ͚ͩ࣋ͭ

    View full-size slide

  38. Objective-CΛ
    ࢓૊Έతʹഉআ
    SwiftԽͷ༏ઌॱҐΛՄࢹԽ

    View full-size slide

  39. 41
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru

    Feature A Feature B Feature C

    Ӆṭ͍ͨ͠

    View full-size slide

  40. 42
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    Environment
    ΠϯλʔϑΣΠεͷΈΛఏڙ

    View full-size slide

  41. 43
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    Environment
    ݹ͍ϥΠϒϥϦ΁ͷґଘ͸
    ΞϓϦͷΈ͕࣋ͭ
    ۩ମతͳ࣮૷

    View full-size slide

  42. 44
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C

    Environment
    ݹ͍ϥΠϒϥϦ΁ͷґଘ͸
    ΞϓϦͷΈ͕࣋ͭ
    ۩ମతͳ࣮૷
    ػೳͷ։ൃ࣌ʹݹ͍ϥΠϒϥϦΛ
    ҙࣝ͠ͳͯ͘ࡁΉΑ͏ʹ

    View full-size slide

  43. 45
    APIClient.share
    Cookpad Tests
    45
    Method Swizzling
    API Stub

    View full-size slide

  44. 46
    Environment
    CookpadEnvironment TestingEnvironment
    Cookpad Tests
    Network Logger ը໘ભҠ

    View full-size slide

  45. 47
    CookpadCore
    CookpadComponent
    Cookpad
    ɾɾɾ
    Cookpad Tsukuru
    Feature A Feature B Feature C




    Ҡߦத
    Ҡߦத

    View full-size slide

  46. ՝୊
    48
    Bundle
    Dynamic Linking Time
    Tsukuru׬શഁյ
    Feature moduleҠߦ
    Ϟδϡʔϧؒͷґଘ
    ద੾ͳϞδϡʔϧ෼ׂ୯Ґ
    ։ൃ૊৫ͷεέʔϧ
    Objective-C׬શഁյ

    View full-size slide

  47. ͝ਗ਼ௌ
    ͋Γ͕ͱ͏͍͟͝·ͨ͠
    !HJHJOFU

    View full-size slide