Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
iOSアプリ単体テスト入門
Search
Yamada Ryo
May 11, 2018
Programming
0
1.4k
iOSアプリ単体テスト入門
初めて単体テストを書いてみたその手法と感想について。
Yamada Ryo
May 11, 2018
Tweet
Share
More Decks by Yamada Ryo
See All by Yamada Ryo
Apple PayとPassword AutoFillの実装方法と困った話
yamadaryo11
0
1k
クラスメソッドでiOSアプリ 開発をする際に使われた技術の紹介
yamadaryo11
1
650
Other Decks in Programming
See All in Programming
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.2k
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2k
as(型アサーション)を書く前にできること
marokanatani
10
2.7k
CSC509 Lecture 12
javiergs
PRO
0
160
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
ヤプリ新卒SREの オンボーディング
masaki12
0
130
Click-free releases & the making of a CLI app
oheyadam
2
120
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
990
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
Outline View in SwiftUI
1024jp
1
330
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Scaling GitHub
holman
458
140k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Bash Introduction
62gerente
608
210k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
110
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
How STYLIGHT went responsive
nonsquared
95
5.2k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Transcript
IOSΞϓϦ୯ମςετ ೖ ΫϥεϝιουגࣜձࣾɹϞόΠϧΞϓϦαʔϏε෦ɿɹࢁాɹྑ
ରऀ • ະͩiOSΞϓϦͰ୯ମςετΛॻ͍ͨ͜ͱͷͳ͍ਓ • ςετ͍͢͠ίʔυͷॻ͖ํ͕ྑ͘Θ͔Βͳ͍ਓ
ςʔϚΛܾΊͨܦҢ • ࢲ͕ࣗiOSΞϓϦͷ୯ମςετΛॻ͍ͨܦݧ͕ͳ͍ • ϓϩδΣΫτͰ୯ମςετΛॻ͘ػձ͕͋ͬͨ • ͜Ε͔Β୯ମςετͷཧղΛਂΊ͍͖͍ͯͨͱ͍͏Ϟν ϕʔγϣϯ
؆୯ͳࣗݾհ • iOSΞϓϦ։ൃܦݧɿ̎ • αʔόαΠυWebFrontɺΈࠐΈwindowsͷΫϥαό ͳͲ৭ʑͳҊ݅ʹབྷΜͰ͍ͨͷͰͣͬͱiOSΞϓϦ։ൃΛ ͍ͯͨ͠༁Ͱͳ͍Ͱ͢ • ݩCOBOLer
ମݧͨ͠୯ମςετͷޮՌ • ͙͢ʹޮՌΛ࣮ײͰ͖ΔͷͰͳ͍ɻ • ޙʑɺʮطଘͷϓϩμΫτίʔυΛഁյ͍ͯ͠ͳ͍͔͕Θ ͔Δʯ • ഁյ͍ͯ͠ͳ͍͜ͱ͕Θ͔ΔͨΊɺਫ਼ਆతʹ҆৺ײ͕͋Δ
ࠓճͷ୯ମςετಋೖͷൣғ • ϏδωεϩδοΫʹద༻ • UIςετʹ͍ͭͯࠓޙͷ՝ͱ͍ͯ͠Δ
ςετΛॻ͜͏ͱͯ͠ͿͪͨΔน • ΊͪΌͪ͘Όςετ͠ʹ͍͘෦͕ग़ͯ͘Δɻ • ఘΊ؊৺
ͦͦςετ͍͢͠ίʔυͱʁ • Dependency Injection(DI)͠·͢ • ґଘ͢ΔϞδϡʔϧΛ෦Ͱੜ͢ΔͷͰͳ͘ɺʮೖ ͢Δʯ
SWIFTͰDIͬͯͲ͏Δͷʁ • protocolΛ্खʹ͏ • ࣗͰॻ͍ͨΫϥεͰ͋ΕɺinitializeͰґଘؔΛೖ ͢Δ • ViewControllerʹDIͰ͖ΔϥΠϒϥϦଘࡏ͢Δ • ViewControllerผ్InjectϝιουΛ࡞ͬͯରԠͨ͠
۩ମతͳྫ.ʢϓϩμΫτʣ ViewController Presenter DataStore Viewͷૢ࡞ APIίʔϧ Viewͷඳը໋ྩ APIίʔϧ໋ྩ • ࠨͷΑ͏ͳߏ
ͷϓϩμΫτΛྫ ʹ͠·͢ɻ • ࠓճPresenter ʹߜͬͯղઆ͠· ͢
۩ମతͳྫ.ʢVIEWCONTROLLERʣ
۩ମతͳྫ.ʢDIʣ
۩ମతͳྫ.ʢPRESENTER - 1ʣ
۩ମతͳྫ.ʢPRESENTER - 2ʣ
۩ମతͳྫ.ʢMOCKʣ
None
None
None
୯ମςετ͍͢͠ϞόΠϧΞʔΩςΫνϟ • ΫϦϯΞʔΩςΫνϟ
ʮςετ͍͢͠ίʔυʯΛແࢹࣦͯ͠ഊͨ͠ྫ • KeychainΛૢ࡞͢ΔγϯάϧτϯΛ༻ͨ͠SDKΛ PresenterͰૢ࡞ͯ͠KeychainͷΛॻ͖͑ͯ͠ ·ͬͨ
SDK͕γϯάϧτϯΦϒδΣΫτΛ͍ͬͯͨ࣌ͷճආ ํ๏ • WrapperΫϥεΛ࡞ͬͯɺprotocolΛܧঝͨ͠Ϋϥεʹแ Μͩ
୯ମςετΛಋೖͨ͠ࡍͷฐ • ࣮ྔʢ࡞ۀྔʣଟ͘ͳΔ • ΠϯλʔϑΣʔε͕มΘΔ༷มߋͷࡍɺमਖ਼ྔ͕ଟ͘ͳͬ ͯਫ਼ਆతʹͭΒ͍
൪֎ฤɿ࣮APIΛୟ͘ςετΛॻ͖͔ͨͬͨ • ຖճࢼ͍ͨ͠Θ͚Ͱͳ͍͕ɺAPIʢ֎෦γεςϜʣ͕ਖ਼ ͍͠ϨεϙϯεΛฦ͍ͯ͠Δ͔ɺ࣌ʑ֬ೝ͔ͨͬͨ͠ • SchemeΛ͚ͯɺ࣮APIΛୟ͘ςετΛผ్࡞ͨ͠ • CIπʔϧʹͯ୯ମςετΛΒ͍͕ͤͯͨɺ࣮APIΛୟ͘ Schemeର֎ͱͨ͠
ݱঢ়ͷײ • Կ͔ഁյతมߋΛ͛ͨ໘͕͋ΓɺޮՌ͋ͬͨ • ॻ͖׳Ε͍ͯͳ͍ɺ࡞ۀ͕ͳ͔ͳ͔ਐ·ͳ͔ͬͨ • Ώ͘Ώ͘Test-DrivenDevelopment(TDD)Λಋೖͯ͠ςε τͰ͖ΔϓϩμΫτίʔυͷΈ͕ଘࡏ͢ΔΑ͏ʹ͍ͨ͠ʢཧ ʣ
͝ਗ਼ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠