Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

աڈͷεϥΠυ • 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

Slide 4

Slide 4 text

Agenda 1. ࡞Γ௚ͨ͠എܠɺ΋͘͠͸ੵΈॏͶΒΕͨྺ࢙ 2. Ͳ͏΍ͬͯ࡞Γ௚ͨ͠ͷ͔ʢώτɺ࣌ؒɺํ๏ʣ 3. ࡞Γ௚ͯ͠ղܾͨ͠ίτ

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

ιʔείʔυ෼ׂͨ͠ޙͷ3,4ϲ݄ • ϋϯόʔΨʔϝχϡʔ->λϒԽ • ঎඼ϖʔδͷϦχϡʔΞϧ • ϓϥΠϕʔτνϟοτػೳ • ͳͲͳͲ… • ୹͍αΠΫϧͰͨ͘͞Μͷ৽ػೳΛϦϦʔεͰ͖ͨ

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

Ϧʔδϣϯ෼ذɺABςετͷංେԽ • if (isUS) {} else {} • if (AB_improve_xxx) {} else {} • if (isUS) { if (AB) {} else {} } else { if (AB) {} else {} } * ͋͘·ͰྫͰ͢ ࣮૷ίετ↗ QAίετ↗

Slide 13

Slide 13 text

Objective-Cͱܕ • class A { init(with string: String) } • NSDictionary *data; • [[A alloc] initWithString:data[@“id”]]; • ಈతܕ෇͚ͱ੩తܕ෇͚͕ࠞࡏ͠ɺ༧ظͤ͵Ϋϥογϡ

Slide 14

Slide 14 text

ΞʔΩςΫνϟ(MVC, MVVM)͕ࠞࡏ • ϝϧΧϦ iOS ͸2013೥ʹϦϦʔε(iOS7͕ϦϦʔε͞Εͨࠒ) • ग़඼ը໘VC Created by Shinichiro Oba on 2013/04/20 • ObjC/Swift, MVC/MVVM ͷڞଘʢࠞࡏʣ

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

⇧ + ⌘ + N

Slide 18

Slide 18 text

⇧ + ⌘ + N Create New Project

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

νʔϜߏ੒ • kitasuke Introducing protobuf in Swift • chuganzy ϝϧΧϦͰ࣮ࢪͨ͠աڈ࠷େن໛ͷABςετʮυϩϫʔ vs Լλϒʯͷ෣୆ཪ • yoichi ϞόΠϧΞϓϦͰࠔΒͳ͍ΤϥʔϋϯυϦϯάͱϩΪϯάͷ ϕετϓϥΫςΟε • jarinosuke US ൛ Mercari Λ·Δ͝ͱ1͔Β࡞Γ௚ͨ͠࿩

Slide 22

Slide 22 text

࣮૷ػೳ • Tab, Home, Login/Signup, Network, Overall architecture • Checkout, Search, WebView • DI, Item Detail, ReactNative • Listing, Local DB, Migration from current app ΊͪΌͪ͘Ό͋Δ

Slide 23

Slide 23 text

࡞ۀ෼୲ • Tab, Home, Login/Signup, Network, Overall architecture • Checkout, Search, WebView • DI, Item Detail, ReactNative • Listing, Local DB, Migration from current app

Slide 24

Slide 24 text

։ൃεέδϡʔϧ • 4݄த०։ൃ։࢝ • 6݄຤ϦϦʔε໨ඪ • ࣮࣭2ϲ݄൒

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

࡞ۀλΠϜϥΠϯ 4݄ 5݄ 6݄ Checkout WebView Search Tab, Home, Login/Signup, Network, Overall architecture DI, Item Detail ReactNative LocalDB Listing Migration

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

before after

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

Swift/protobufͰܕ҆શ • protocol buffer • API Request/Response Ͱѻ͏ Model ͱͦͷϓϩύςΟͷܕ͕ อূ͞Εͨ • ৄ͘͠͸ kitasuke ͞Μͷ͜ͷهࣄ • kitasuke Introducing protobuf in Swift

Slide 34

Slide 34 text

BitriseʹҠߦ͠ϝϯςφϯείετ࡟ݮ • ࠓ·Ͱ͸ࣗલͷ Jenkins on Mac • සൟʹωοτϫʔΫʹΞΫηεͰ͖ͣʹམͪΔ • ֎෦IP͔ΒΞΫηεͰ͖ͳ͍ • Xcode ͷόʔδϣϯΞοϓ

Slide 35

Slide 35 text

Swinject ʹΑΔ DI Ͱ Testable ͳߏ੒ʹ • ΞϓϦશମͷΞʔΩςΫνϟ΋ DI Λҙࣝͨ͜͠ͱʹΑΓ౷Ұ͞ Εͨ • Author ͷ yoichi ͞ΜࣗΒಋೖͯ͘͠Εͨ • ViewModel ʹରͯ͠ Service Λ Injectable ͳߏ੒ʹͨ͠

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

Swinject ʹΑΔ DI Ͱ Testable ͳߏ੒ʹ Mercari Tech Conf 2017
 US൛Mercari iOSΞϓϦͷΞʔΩςΫνϟͱDependency Injection

Slide 38

Slide 38 text

͓ΘΓʹ

Slide 39

Slide 39 text

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