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
実践!「みてね」における自動生成活用例
Search
shunsuke sato
September 21, 2020
Programming
5
6.1k
実践!「みてね」における自動生成活用例
shunsuke sato
September 21, 2020
Tweet
Share
More Decks by shunsuke sato
See All by shunsuke sato
要約 "Add Live Text interaction to your app"
ushisantoasobu
1
910
ANDPAD iOS開発の生態系と課題 - 最近取り組み始めた「マルチモジュール化」について
ushisantoasobu
1
770
Summary of Diagnose unreliable code with test repetitions
ushisantoasobu
1
950
5 Tips when test fails randomly
ushisantoasobu
2
3.6k
Better Way for Test Data Generation??
ushisantoasobu
1
2.7k
iOS/Androidのサブスクリプション実装における違いをざっと振り返る
ushisantoasobu
2
1.6k
24時間でMacアプリを作ってスベってきた話
ushisantoasobu
0
2.1k
Redirectable in App?
ushisantoasobu
2
900
iOSのClean Architecture テンプレ自動生成を支える技術 / generating CA's templates
ushisantoasobu
0
280
Other Decks in Programming
See All in Programming
距離関数を極める! / SESSIONS 2024
gam0022
0
290
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
230
Contemporary Test Cases
maaretp
0
140
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
役立つログに取り組もう
irof
28
9.6k
C++でシェーダを書く
fadis
6
4.1k
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Ethereum_.pdf
nekomatu
0
460
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
40
2.4k
Unsuck your backbone
ammeep
668
57k
The Language of Interfaces
destraynor
154
24k
A designer walks into a library…
pauljervisheath
204
24k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Rails Girls Zürich Keynote
gr2m
94
13k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Music & Morning Musume
bryan
46
6.2k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Transcript
࣮ફʂʮΈͯͶʯʹ͓͚Δࣗಈੜ׆༻ྫ !J04%$+BQBO
ࣗݾհ • ໊લ: ࠤ౻ढ़ี • TwitterͳͲ: @ushisantoasobu • ॴଐ: ʢגʣϛΫγΟ
ΈͯͶࣄۀ෦ • ։ൃ: iOSΛϝΠϯʹɺAndroid / Rails ͳͲ • झຯ: αοΧʔʢϑοταϧʣͱ ίʔώʔ
ʮΈͯͶʯͱʁ • ʮՈΞϧόϜ ΈͯͶʯʢ ւ֎ͰʮFamilyAlbumʯʣ • ࢠڙͷࣸਅಈըΛɺՈͰڞ༗͢ΔΞϓϦ • ΈͯͶͷiOSΞϓϦʹ͍ͭͯ •
։ൃ։͔࢝Β7 • ʮεϐʔυ༏ઌ < ෦తͳ࣭ʯͳ։ൃϑΣʔζ
ΞδΣϯμ • ʮࣗಈੜʯʹڵຯΛ͖͔͚࣋ͬͨͬ • ͜ͷτʔΫͰѻ͏ʮࣗಈੜʯͱ • ΈͯͶʹ͓͚Δࣗಈੜ׆༻ྫ 3ͭ • Sourcery
/ Stencil ͷجຊతͳ • Sourcery / Stencil ͷTIPS • ࣗಈੜΛ1ӡ༻ͯ͠Έͯͷॴײ • ·ͱΊ
ʮࣗಈੜʯʹڵຯΛ͖͔͚࣋ͬͨͬ IUUQTXXXZPVUVCFDPNXBUDI W5LHG0C6
ʮࣗಈੜʯʹڵຯΛ͖͔͚࣋ͬͨͬ • UIKonf 2019 ͰͷUberͷΤϯδχΞͷํʹΑΔࣗಈੜʢ”Mockolo”ʣʹ͍ͭͯͷൃද • UberͰશͯͷϓϩμΫτͰܭ230ສߦ΄Ͳͷίʔυϕʔε • ͦͷ͏ͪʮࣗಈੜʯ͞Εͨͷ
ʮࣗಈੜʯʹڵຯΛ͖͔͚࣋ͬͨͬ • UIKonf 2019 ͰͷUberͷΤϯδχΞͷํʹΑΔࣗಈੜʢ”Mockolo”ʣʹ͍ͭͯͷൃද • UberͰશͯͷϓϩμΫτͰܭ230ສߦ΄Ͳͷίʔυϕʔε • ͦͷ͏ͪʮࣗಈੜʯ͞Εͨͷ
͜ͷτʔΫͰѻ͏ʮࣗಈੜʯͱ • Ϧιʔε·ΘΓΛλΠϓηʔϑͳSwiftͷίʔυͱͯࣗ͠ಈੜ͢Δͷ • RSwift, SwiftGenͳͲ • ίʔυΛॻ͖͡ΊΔ͏͑ͰͷςϯϓϨʔτࣗಈੜ • ෳࡶͳΞʔΩςΫνϟͷಋೖ͕ҰൠతʹͳΔʹͭΕɺधཁ͕ߴ·͍ͬͯΔʁ
• ʮ͋ΔίʔυΛͱʹɺผͷίʔυΛੜ͢Δʯʢϝλϓϩάϥϛϯάʣ • Sourcery / Stencil ͳͲΛར༻͢Δ
• Ϧιʔε·ΘΓΛλΠϓηʔϑͳSwiftͷίʔυͱͯࣗ͠ಈੜ͢Δͷ • RSwift, SwiftGenͳͲ • ίʔυΛॻ͖͡ΊΔ͏͑ͰͷςϯϓϨʔτࣗಈੜ • ෳࡶͳΞʔΩςΫνϟͷಋೖ͕ҰൠతʹͳΔʹͭΕɺधཁ͕ߴ·͍ͬͯΔʁ •
ʮ͋ΔίʔυΛͱʹɺผͷίʔυΛੜ͢Δʯʢϝλϓϩάϥϛϯάʣ • Sourcery / Stencil ͳͲΛར༻͢Δ ͜ͷτʔΫͰѻ͏ʮࣗಈੜʯͱ
ΈͯͶʹ͓͚Δࣗಈੜ׆༻ྫͭ • 1. ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου • 2. DIͷґଘؔղܾ • 3. ϞοΫ
ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου • [લఏ] • ΈͯͶͰGUIΞʔΩςΫνϟʹMVPΛ࠾༻͍ͯ͠Δ • ςετΛॻ͍͍ͯΔ
͜ͷΑ͏ͳQSFTFOUFSͷςετΛॻ͍͍ͯΔ ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
ελϒ͕ฦ͢Ληοτ͢Δ ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
ςετରͷϝιουΛ࣮ߦ ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
ϞοΫʢzWJFXzʣ͕ਖ਼͍͠ڍಈΛ͍ͯ͠Δ͜ͱΛ֬ೝ͢Δ ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
ʮελϒ͕ฦ͢ʯͱʁ ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
͜͜Λॻ͘ͷ͕खؒͱ͍͏՝͕νʔϜͰ͋ͬͨ ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
"TTFSU͍ͯ͠ΔͷzJEz͚ͩ ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
֤Entityʹରͯ͠ ʮͦΕͧΕͷܕʹରԠͨ͠”ͦΕΆ͍”σϑΥϧτҾΛ࣋ͭϏϧμʔϝιουʯΛ ςετλʔήοτʹextensionͱͯࣗ͠ಈੜ͢Δ ͱ͍͏ΞΠσΞΛࢥ͍ͭ͘ ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
͜ͷΑ͏ͳ&OUJUZʹରͯ͠ ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
͜ͷΑ͏ͳͷϏϧμʔϝιουΛࣗಈੜ͢Δ ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
ʮͦΕͧΕͷܕʹରԠͨ͠zͦΕΆ͍zσϑΥϧτҾΛ࣋ͭϏϧμʔϝιουʯ ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
͖͞΄Ͳͷςετ͕͜ͷΑ͏ʹεοΩϦॻ͚Δ ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου
%*ͷґଘؔղܾ • [લఏ] • γεςϜΞʔΩςΫνϟʹCleanArchitectureΛ࠾༻͍ͯ͠Δ • ґଘ͢ΔͷDI͍ͯ͠Δ • ґଘؔղܾͷॲཧɺखͰΰϦΰϦॻ͍͍ͯͨ •
ʢҎલαʔυύʔςΟͷϥΠϰϥϦΛར༻͍ͯͨ͠ɻ͜͜ΒΜͷܦҢʹ͍ͭͯޙड़ʣ
IUUQTTQFBLFSEFDLDPNKTTF[IPXUPNBOBHFEJXJUIPVUVTJOHFYUFSOBMMJCSBSZJOTXJGU %*ͷґଘؔղܾ
͜ͷΑ͏ͳґଘؔղܾͷίʔυΛɺ͜Ε·ͰʮखͰΰϦΰϦॻ͍͍ͯͨʯ͕ ࠓʮࣗಈੜʯ͞ΕΔΑ͏ʹͳͬͨ %*ͷґଘؔղܾ
ͦΕͧΕ%*͢Δͷʢϓϩτίϧʣʹରͯ͠ %*ͷґଘؔղܾ
ͦͷ࣮ମΛฦ͢ϑΝΫτϦʔϝιου %*ͷґଘؔղܾ
ϞοΫ • [લఏ] • DIಉ༷ɺϞοΫʮखͰΰϦΰϦʯॻ͍͍͔ͯͨ ”SwiftMockGeneratorForXcode”ʢXcode extensionʣΛར༻͍ͯͨ͠
4XJGU.PDL(FOFSBUPS'PS9DPEFͱಉ͡Α͏ͳ*'ͷͷΛࣗಈੜͯ͠Έͨ ϞοΫ
• ʢ͜ͷτʔΫ͕࠾͞Ε͔ͯΒɺSourcery / Stencil ͷ෮श͕ͯΒͬͯΈͨʣ • -> ·ͩӡ༻࢝͠Ί͔ͨΓ • ϞοΫͷࣗಈੜΛͪΌΜͱΖ͏ͱࢥͬͨΒ݁ߏ͔ͬͨ͠
• ʮࣗಈੜΛͲ͜·ͰΓ͖Δ͔ʯॏཁͳϙΠϯτͱೝࣝɻޙड़͢Δ ϞοΫ
ΈͯͶʹ͓͚Δࣗಈੜ׆༻ྫσϞΞϓϦ https://github.com/ushisantoasobu/iosdc-2020-demo
Sourcery / Stencil ͷجຊతͳઆ໌
4PVSDFSZͬͯͦͦԿʁ • SwiftͰʮ͋Δίʔυ͔ΒɺผͷίʔυΛੜ͢ΔʯʢϝλϓϩάϥϛϯάʣͨΊͷϥΠϒϥϦ • https://github.com/krzysztofzablocki/Sourcery • ʮ͋Δίʔυ͔ΒɺผͷίʔυΛੜ͢Δʯ= ҎԼͷ2ͭͷϥΠϒϥϦʹґଘ͍ͯ͠Δ • ίʔυͷղੳ
-> SourceKittenʢSourceKitʣ • ςϯϓϨʔτΤϯδϯ -> Stencil
4UFODJMͬͯͦͦԿʁ • ςϯϓϨʔτΤϯδϯ • https://github.com/stencilproject/Stencil • ʢREADMEΑΓʣSwiftGen, Kitura, Weaver, Genesis
ͳͲͰར༻͞Ε͍͍ͯΔ • Variables / Filters / Tags ʢҎ߱ͷϖʔδͰઆ໌ʣ
4UFODJMͬͯͦͦԿʁ ςϯϓϨʔτϑΝΠϧͷݟͨ͜Μͳײ͡
4UFODJMͬͯͦͦԿʁ 7BSJBCMFTදࣔ͢Δม
4UFODJMͬͯͦͦԿʁ 5BHTGPSJGͳͲͷ੍ޚߏจ
4UFODJMͬͯͦͦԿʁ 'JMUFSTมΛʮม͢Δʯͷ
4PVSDFSZ4UFODJMΛͬͨࣗಈੜͷୈҰา
XcodeͰϓϩδΣΫτ࡞ͬͯɺSourceryΠϯετʔϧࡁΈͷͱ͜Ζ͔Βελʔτ ʢΠϯετʔϧʹ͍ͭͯলུɻ͜͜ͰcocoapodsͰΠϯετʔϧʣ 4PVSDFSZ4UFODJMΛͬͨࣗಈੜͷୈҰา
l)PHFzl'VHBzͱ͍͏໊લͷͭͷTUSVDU͕ɺz&OUJUZzσΟϨΫτϦʹ͋Δͱ͢Δ 4PVSDFSZ4UFODJMΛͬͨࣗಈੜͷୈҰา
͜ͷΑ͏ͳςϯϓϨʔτʢTUFODJMϑΝΠϧʣΛॻ͍ͯΈΔ 4PVSDFSZ4UFODJMΛͬͨࣗಈੜͷୈҰา
શͯͷzTUSVDUzʹରͯ͠GPSϧʔϓΛճ͢ 4PVSDFSZ4UFODJMΛͬͨࣗಈੜͷୈҰา
zTUSVDUzͷ໊લΛग़ྗ͢Δ 4PVSDFSZ4UFODJMΛͬͨࣗಈੜͷୈҰา
TPVSDFSZίϚϯυΛ࣮ߦ͢Δ 4PVSDFSZ4UFODJMΛͬͨࣗಈੜͷୈҰา
lTPVSDFTzҾࣗಈੜରϑΝΠϧؚ͕·ΕΔσΟϨΫτϦΛࢦఆ 4PVSDFSZ4UFODJMΛͬͨࣗಈੜͷୈҰา
lUFNQMBUFTzҾςϯϓϨʔτϑΝΠϧΛࢦఆ 4PVSDFSZ4UFODJMΛͬͨࣗಈੜͷୈҰา
lPVUQVUzҾͰࣗಈੜ͢ΔϑΝΠϧͷग़ྗઌΛࢦఆ 4PVSDFSZ4UFODJMΛͬͨࣗಈੜͷୈҰา
ͦΕͧΕͷTUSVDUͷ໊લ͕ग़ྗ͞ΕͨϑΝΠϧ͕ࣗಈੜ͞Εͨ 4PVSDFSZ4UFODJMΛͬͨࣗಈੜͷୈҰา
ʮʮελϒ͕ฦ͢ʯͷศརʙʯͷςϯϓϨʔτΛோΊͯΈΔ
͜ͷΑ͏ͳͷΛࣗಈੜ͢ΔʹͲͷΑ͏ͳςϯϓϨʔτϑΝΠϧΛॻ͘ඞཁ͕͋Δʁ ʮʮελϒ͕ฦ͢ʯͷศརʙʯͷςϯϓϨʔτΛோΊͯΈΔ
ʮʮελϒ͕ฦ͢ʯͷศརʙʯͷςϯϓϨʔτΛோΊͯΈΔ
શͯͷTUSVDUΛGPSϧʔϓͰճͯ͠ɺϏϧμʔϝιουΛੜ͢ʢ͜͜ΒΜൺֱతγϯϓϧͳͷͰলུʣ ʮʮελϒ͕ฦ͢ʯͷศརʙʯͷςϯϓϨʔτΛோΊͯΈΔ
ʮʮελϒ͕ฦ͢ʯͷศརʙʯͷςϯϓϨʔτΛோΊͯΈΔ
TUSVDUͷશͯͷมͰGPSϧʔϓͰճ͢ ʮʮελϒ͕ฦ͢ʯͷศརʙʯͷςϯϓϨʔτΛோΊͯΈΔ
ΦϓγϣφϧͳΒσϑΥϧτҾͷΛzOJMzͱग़ྗ͢Δ ʮʮελϒ͕ฦ͢ʯͷศརʙʯͷςϯϓϨʔτΛோΊͯΈΔ
Ұൠతͳܕʹ͍ͭͯɺͦΕͧΕʹରԠͨ͠ʮͦΕΆ͍ʯΛσϑΥϧτҾͷͱͯ͠ग़ྗ͢Δ ʮʮελϒ͕ฦ͢ʯͷศརʙʯͷςϯϓϨʔτΛோΊͯΈΔ
&OVNʹ͍ͭͯ࠷ॳͷΛσϑΥϧτҾͷͱͯ͠ग़ྗ͢Δɻ ͨͩ͠"TTPDJBUFE7BMVFΛͭʹରͯ͠͏·ࣗ͘ಈੜ͢Δͷ͕͔ͬͨ͠ͷͰɺ࣍ͷʮॻ͖ʯͰճආ͢ΔΑ͏ʹͨ͠ ʮʮελϒ͕ฦ͢ʯͷศརʙʯͷςϯϓϨʔτΛோΊͯΈΔ
ࣗಈੜ͕͍͠ͷʹ͍ͭͯɺσϑΥϧτҾͷΛʮॻ͖ʯͯ͠ग़ྗ͢Δ ʮʮελϒ͕ฦ͢ʯͷศརʙʯͷςϯϓϨʔτΛோΊͯΈΔ
Πέςͳ͍ʁͰࣗಈੜʮࣗͨͪͰίϯτϩʔϧͰ͖Δʯ෦͕ൺֱతଟ͍ͷͰ దٓճආࡦ͕ݟ͚͍ͭ͢ϝϦοτͰ͋Δͱೝ͍ࣝͯ͠Δ ʮʮελϒ͕ฦ͢ʯͷศརʙʯͷςϯϓϨʔτΛோΊͯΈΔ
ͦΕҎ֎ผͷ&OUJUZͷͣͳͷͰɺͦΕΒʹ͍ͭͯσϑΥϧτҾͷͱͯͦ͠ͷ&OUJUZͷϏϧμʔϝιουΛग़ྗ͢Δ ʮʮελϒ͕ฦ͢ʯͷศརʙʯͷςϯϓϨʔτΛோΊͯΈΔ
4PVSDFSZ4UFODJMิ • ઌ΄ͲSourceryͷCLIΛར༻ͯࣗ͠ಈੜΛߦͳ͕ͬͨɺ࣮ࡍʹӡ༻͢Δࡍ ʮ”Run Script”ʹίϚϯυΛهड़ͯ͠Ϗϧυຖʹ࣮ߦʯͱͳΔͣ • “sources” / “templates” /
“output” ͳͲͷҾ”.sourcery.yml”ʹ·ͱΊΔ͜ͱ͕Ͱ͖Δ • ΈͯͶͰग़ྗઌ͕ෳʢΞϓϦ/ςετʣඞཁͷͨΊ”.sourcery.yml”͑ͳ͍ • ࢀߟ -> https://github.com/krzysztofzablocki/Sourcery/issues/727
Sourcery / Stencil Λ׆༻͢Δ͏͑ͰͷTIPS
υΩϡϝϯτͱᛀΊͬ͜͢Δඞཁ͕͋Δ
υΩϡϝϯτͱᛀΊͬ͜͢Δඞཁ͕͋Δ ྫ͑͜ͷzTUSVDUz͔ΒɺଞʹͲΜͳΛࢀর͢Δ͜ͱ͕Ͱ͖Δͷʁ
υΩϡϝϯτͱᛀΊͬ͜͢Δඞཁ͕͋Δ
υΩϡϝϯτͱᛀΊͬ͜͢Δඞཁ͕͋Δ lLJOEzϓϩύςΟ͔͠ͳ͍ʁ
υΩϡϝϯτͱᛀΊͬ͜͢Δඞཁ͕͋Δ l5ZQFzͱ͍͏ΫϥεΛܧঝ͍ͯ͠Δ
υΩϡϝϯτͱᛀΊͬ͜͢Δඞཁ͕͋Δ lOBNFzlBMM7BSJBCMFTzlBMM.FUIPETzͳͲͷʮྑ͍ͦ͘͏ͳʯϓϩύςΟ͕͋Δ
υΩϡϝϯτͱᛀΊͬ͜͢Δඞཁ͕͋Δ 1. ࣗಈੜ͍ͨ͠ͷΛΠϝʔδ͢ΔʢPlanʣ 2. υΩϡϝϯτΈͭͭɺͱΓ͋͑ͣࣗಈੜͯ͠ΈΔʢDoʣ 3. ࣗಈੜ͞ΕͨͷΛ֬ೝ͢ΔʢCheckʣ 4. Πϝʔδ͍ͯͨ͠ͷ͕ਖ਼͘͠ੜ͞Ε͍ͯͳ͔ͬͨͷͰɺ࠶υΩϡϝϯτݟ͢ʢActionʣ •
PDCAαΠΫϧΛճ͍ͯ͘͠ײ͡ʹͳΔͣ
υΩϡϝϯτͱᛀΊͬ͜͢Δඞཁ͕͋Δ • Sourcery -> https://cdn.rawgit.com/krzysztofzablocki/Sourcery/master/docs/index.html • Stencil -> https://stencil.fuller.li/en/latest/
4UFODJM4XJGU,JUΛ͓ͬͯ͘ • https://github.com/SwiftGen/StencilSwiftKit • Stencilͷ֦ுػೳΈ͍ͨͳͷ • Stenicilͷඪ४ػೳ͚ͩͰ࣮ݱͰ͖ͳ͍ͷΛ࣮ݱͰ͖Δ • Stenicilͷඪ४ػೳ͚ͩͰ࣮ݱ͢Δͷ͕େมͳͷΛ؆୯ʹ࣮ݱͰ͖Δ •
SourceryͷREADMEʹҰهड़͕ͳ͍͕ɺSourcery͔Βར༻Ͱ͖Δ • ͪ͜ΒυΩϡϝϯτΈͯɺར༻Ͱ͖ΔػೳΛѲ͓ͯ͘͠ͱྑ͍
• ಛʹ”macro”ศར • ଞʹศརͳͷ͕ͨ͘͞Μ͋Δ • “Map”ͱ͍͏tagɺ”hasPrefix”ͱ͍͏filterΈͯͶͰར༻͍ͯ͠Δ 4UFODJM4XJGU,JUΛ͓ͬͯ͘
NBDSPͷྫ 4UFODJM4XJGU,JUΛ͓ͬͯ͘
Ұ෦ͷςϯϓϨʔτΛNBDSPͱͯ͠ఆٛͰ͖Δ 4UFODJM4XJGU,JUΛ͓ͬͯ͘
NBDSPΛผͷॴ͔Βݺͼग़͢͜ͱ͕Ͱ͖Δɻ ςϯϓϨʔτΤϯδϯͷՄಡੑΛ͋͛ͨΓɺಉ͡Α͏ͳςϯϓϨʔτΛॻ͘͜ͱΛආ͚Δ͜ͱ͕Ͱ͖Δ 4UFODJM4XJGU,JUΛ͓ͬͯ͘
4PVSDFSZͷʮαϯϓϧूʯΛࢀߟʹ͢Δ IUUQTHJUIVCDPNLS[ZT[UPG[BCMPDLJ4PVSDFSZUSFFNBTUFS5FNQMBUFT5FNQMBUFT
ࣗಈੜΛͲ͜·Ͱ্͛Δ͖͔ • ࣗಈੜΛߦ͏্Ͱɺ࣮ݱ͢Δͷ͕Ͳ͏͍ͯ͠͠ίʔφʔέʔε͕Ͱ͖ͯͨͱ͖ • ͋·ΓʮؤுΓ͗͢ͳ͍ʯ͜ͱ • ʮϝϯςͰ͖ͳ͍ʯςϯϓϨʔτϑΝΠϧ࡞Γͨ͘ͳ͍ • νʔϜͰӡ༻Ͱ͖Δ͜ͱ͕ॏཁ •
ճආࡦ͋Δ • ςϯϓϨʔτଆͰճආ͢Δ -> ྫ) ʮελϒ͕ฦ͢ʯͷศརϏϧμʔϝιου • ࣗಈੜͷର͔Β֎͢ʢͦΕΒखͰॻ͘ʣ
• ࣗಈੜͷର͔Β֎͢ = ରϑΝΠϧΛʮࡉ͔͘ʯద༻͢Δ͜ͱͰ͖Δ • બύλʔϯ • ઐ༻ͷprotocolΛ࡞͠ద༻͢ΔʢͦͷprotocolΛࣗಈੜରͷҹͱ͢Δʣ • আ֎ύλʔϯ
• ʢҰൠతͰͳ͍͕ɺΈͯͶͰͪ͜ΒͰӡ༻͍ͯ͠Δʣ • আ֎͢Δ class/struct/protocolʢͳͲʣ ໊ΛςϯϓϨʔτϑΝΠϧʹʮϕλॻ͖ʯͯ͠ɺif จͳͲͰআ֎͢Δ ࣗಈੜΛͲ͜·Ͱ্͛Δ͖͔
ࡶʹ࣮ɺͦͷ͋ͱϦϑΝΫλϦϯά 1. ͪΐͬͱԚ͍͕ɺత௨Γͷͷ͕ࣗಈੜ͞ΕΔςϯϓϨʔτΛॻ͘ 2. Ұ୴ίϛοτ 3. ϦϑΝΫλ͠ͳ͕Βࣗಈੜ -> ࣗಈੜ͞ΕΔͷʹ͕ࠩͳ͚ΕOK •
ʢςετ͕͋Δ͔Β҆৺ͯ͠ϦϑΝΫλͰ͖ΔͷͱࣅͯΔʣ
1ؒӡ༻ͯ͠ΈͯͷॴײͳͲ
ಛʹେ͖ͳى͖ͨ͜ͱ͕ͳ͍ • ઌड़ͨ͠ͱ͓ΓɺҎԼͷΑ͏ͳ͜ͱ͕Ͱ͖ΔͨΊ • ςϯϓϨʔτʹԿ͔͠ΒखΛೖΕͯճආ • ࣗಈੜͷର͔Β֎͢
ࣗಈੜWTϥΠϒϥϦʁ • DIͱ͔ϞοΫʮαʔυύʔςΟͷϥΠϒϥϦΛ͑ྑ͍ͷͰʁʯͱࢥͬͨํଟ͍ͣ
• ϥΠϒϥϦͷཧίετҙ֎ʹߴ͍ • ࠷৽ͷόʔδϣϯʹै͢Δίετ • ສ͕Ұಈ͔ͳ͘ͳͬͨͱ͖/ෆ۩߹͕ग़ͨͱ͖ͷରԠίετ • ՝ղܾ͢Δ͏͑ͰɺαʔυύʔςΟͷϥΠϒϥϦΛར༻͢Δͱ͍͏બࢶͱಉʹʮࣗಈੜ ʯΛར༻͢Δͱ͍͏બࢶฒͯྑ͍ͷͰ ࣗಈੜWTϥΠϒϥϦʁ
·ͱΊ
·ͱΊ • ՝ղܾͷ1ͭͱͯ͠ʮࣗಈੜʯΛݕ౼ʹೖΕͯΈͯͲ͏͔ • ࣗಈੜΛͲ͜·ͰΓΔ͔ҙࣝ͢Δͱྑͦ͞͏
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠!!!