US 版 Mercari をまるごと1から作り直した話

84e9eed4cd2df442347ff56aae03868c?s=47 Naoki ISHIKAWA
September 17, 2017

US 版 Mercari をまるごと1から作り直した話

iOSDC 2017 in Tokyo, September 16-17, 2017
https://iosdc.jp/2017/node/1438

84e9eed4cd2df442347ff56aae03868c?s=128

Naoki ISHIKAWA

September 17, 2017
Tweet

Transcript

  1. US ൛ Mercari Λ·Δ͝ͱ 1͔Β࡞Γ௚ͨ͠࿩ iOSDC Japan 2017 Naoki Ishikawa

    @jarinosuke
  2. ࣗݾ঺հ • ੴ઒௚थ (@jarinosuke) • Mercari, Inc (joined at 2016/05)

    •iOS Engineer
  3. աڈͷεϥΠυ • Drink Meetup with Mercari iOS(2016೥6݄) • https://speakerdeck.com/jarinosuke/drink-meetup-with- mercari-number-36

    • Mercari Day 2017(2017೥1݄) • https://speakerdeck.com/jarinosuke/mercari-day-2017
  4. Agenda 1. ࡞Γ௚ͨ͠എܠɺ΋͘͠͸ੵΈॏͶΒΕͨྺ࢙ 2. Ͳ͏΍ͬͯ࡞Γ௚ͨ͠ͷ͔ʢώτɺ࣌ؒɺํ๏ʣ 3. ࡞Γ௚ͯ͠ղܾͨ͠ίτ

  5. 1.࡞Γ௚ͨ͠എܠɺ ΋͘͠͸ੵΈॏͶΒΕͨྺ࢙

  6. mercari-ios ͷྺ࢙ ! " 2016/11 master

  7. mercari-ios ͷྺ࢙ ! " 2016/11ࠒ master jp/master

  8. ιʔείʔυ෼ׂ • ϚϧνιʔεϚϧνόΠφϦ • ୯Ұ repos Ͱ branch ͰϦʔδϣϯຖʹ෼ׂ

  9. mercari-ios ͷྺ࢙ ! " 2016/11ࠒ master jp/master 2017/4த० ໿3,4ϲ݄

  10. ιʔείʔυ෼ׂͨ͠ޙͷ3,4ϲ݄ • ϋϯόʔΨʔϝχϡʔ->λϒԽ • ঎඼ϖʔδͷϦχϡʔΞϧ • ϓϥΠϕʔτνϟοτػೳ • ͳͲͳͲ… •

    ୹͍αΠΫϧͰͨ͘͞Μͷ৽ػೳΛϦϦʔεͰ͖ͨ
  11. ґવͱͯ͠࢒Δ՝୊ • Ϧʔδϣϯ෼ذɺABςετͷංେԽ • Objective-Cͱܕ • ΞʔΩςΫνϟ(MVC, MVVM)͕ࠞࡏ मਖ਼ʹରͯ͠ͷίετ͕ͱͯ΋ߴ͘ͳ͖͍ͬͯͯͨ

  12. Ϧʔδϣϯ෼ذɺABςετͷංେԽ • if (isUS) {} else {} • if (AB_improve_xxx)

    {} else {} • if (isUS) { if (AB) {} else {} } else { if (AB) {} else {} } * ͋͘·ͰྫͰ͢ ࣮૷ίετ↗ QAίετ↗
  13. Objective-Cͱܕ • class A { init(with string: String) } •

    NSDictionary *data; • [[A alloc] initWithString:data[@“id”]]; • ಈతܕ෇͚ͱ੩తܕ෇͚͕ࠞࡏ͠ɺ༧ظͤ͵Ϋϥογϡ
  14. ΞʔΩςΫνϟ(MVC, MVVM)͕ࠞࡏ • ϝϧΧϦ iOS ͸2013೥ʹϦϦʔε(iOS7͕ϦϦʔε͞Εͨࠒ) • ग़඼ը໘VC Created by

    Shinichiro Oba on 2013/04/20 • ObjC/Swift, MVC/MVVM ͷڞଘʢࠞࡏʣ
  15. mercari-ios ͷྺ࢙ ! " 2016/11ࠒ master jp/master 2017/4த०

  16. mercari-ios ͷྺ࢙ ! " 2016/11ࠒ master jp/master 2017/4த०

  17. ⇧ + ⌘ + N

  18. ⇧ + ⌘ + N Create New Project

  19. 2.Ͳ͏΍ͬͯ࡞Γ௚͔ͨ͠ ʢώτɺ࣌ؒɺํ๏ʣ

  20. νʔϜߏ੒ • kitasuke • chuganzy • yoichi • jarinosuke

  21. νʔϜߏ੒ • kitasuke Introducing protobuf in Swift • chuganzy ϝϧΧϦͰ࣮ࢪͨ͠աڈ࠷େن໛ͷABςετʮυϩϫʔ

    vs Լλϒʯͷ෣୆ཪ • yoichi ϞόΠϧΞϓϦͰࠔΒͳ͍ΤϥʔϋϯυϦϯάͱϩΪϯάͷ ϕετϓϥΫςΟε • jarinosuke US ൛ Mercari Λ·Δ͝ͱ1͔Β࡞Γ௚ͨ͠࿩
  22. ࣮૷ػೳ • Tab, Home, Login/Signup, Network, Overall architecture • Checkout,

    Search, WebView • DI, Item Detail, ReactNative • Listing, Local DB, Migration from current app ΊͪΌͪ͘Ό͋Δ
  23. ࡞ۀ෼୲ • Tab, Home, Login/Signup, Network, Overall architecture • Checkout,

    Search, WebView • DI, Item Detail, ReactNative • Listing, Local DB, Migration from current app
  24. ։ൃεέδϡʔϧ • 4݄த०։ൃ։࢝ • 6݄຤ϦϦʔε໨ඪ • ࣮࣭2ϲ݄൒

  25. None
  26. ࡞ۀλΠϜϥΠϯ 4݄ 5݄ 6݄ Checkout WebView Search Tab, Home, Login/Signup,

    Network, Overall architecture DI, Item Detail ReactNative LocalDB Listing Migration
  27. ༏ઌͨ͠ίτ • ͓٬༷͕ϦχϡʔΞϧΛҙࣝͤͣ࢖͏͜ͱ͕Ͱ͖Δ • ΞʔΩςΫνϟΛ౷Ұ͢Δɺςελϒϧͳߏ੒Λҡ࣋͢Δ • ϦϦʔε͓ͯ͠٬༷ʹ৽͍͠ΞϓϦΛಧ͚Δ

  28. ༏ઌ͠ͳ͔ͬͨίτ • ॆ෼ͳςετίʔυ • iPad ରԠ • طଘΞϓϦͷ࢓༷ʢθϩ͔Βߟ͑Δʣ

  29. before after

  30. 3.࡞Γ௚ͯ͠ղܾͨ͠ίτ

  31. طଘʹ༷͋ͬͨʑͳϢʔεέʔεΛ࡟আ • Ϧʔδϣϯ("/!)ʹΑΔίʔυ෼ذ • 20ݸऑͷABςετʹΑΔίʔυ෼ذ • ΞϓϦέʔγϣϯϩδοΫͷΈʹूதͰ͖ΔΑ͏ʹͳͬͨ

  32. Swift/protobufͰܕ҆શ before after Objective-C Free

  33. Swift/protobufͰܕ҆શ • protocol buffer • API Request/Response Ͱѻ͏ Model ͱͦͷϓϩύςΟͷܕ͕

    อূ͞Εͨ • ৄ͘͠͸ kitasuke ͞Μͷ͜ͷهࣄ • kitasuke Introducing protobuf in Swift
  34. BitriseʹҠߦ͠ϝϯςφϯείετ࡟ݮ • ࠓ·Ͱ͸ࣗલͷ Jenkins on Mac • සൟʹωοτϫʔΫʹΞΫηεͰ͖ͣʹམͪΔ • ֎෦IP͔ΒΞΫηεͰ͖ͳ͍

    • Xcode ͷόʔδϣϯΞοϓ
  35. Swinject ʹΑΔ DI Ͱ Testable ͳߏ੒ʹ • ΞϓϦશମͷΞʔΩςΫνϟ΋ DI Λҙࣝͨ͜͠ͱʹΑΓ౷Ұ͞

    Εͨ • Author ͷ yoichi ͞ΜࣗΒಋೖͯ͘͠Εͨ • ViewModel ʹରͯ͠ Service Λ Injectable ͳߏ੒ʹͨ͠
  36. Swinject ʹΑΔ DI Ͱ Testable ͳߏ੒ʹ ViewModel struct ViewModel {

    let service: Service typealias Dependency = Service init(dependency: Dependency) { service = dependency } } ֎෦ʹґଘ͍ͯ͠Δ Service ͸ protocol ʹ੾Γग़͠ɺMock Ͱ͖ΔΑ͏ʹઃܭ
  37. Swinject ʹΑΔ DI Ͱ Testable ͳߏ੒ʹ Mercari Tech Conf 2017


    US൛Mercari iOSΞϓϦͷΞʔΩςΫνϟͱDependency Injection
  38. ͓ΘΓʹ

  39. ืू https://open.talentio.com/ 1/c/mercari/requisitions/ detail/4256