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
Mockable UserDefaults with Duck typing
Search
417.72KI
June 18, 2019
Programming
0
1k
Mockable UserDefaults with Duck typing
417.72KI
June 18, 2019
Tweet
Share
More Decks by 417.72KI
See All by 417.72KI
Reboot a personal app abandoned for 10 years with recent techs
417_72ki
0
54
iTunes・おぼえていますか〜ScriptingBridge今昔物語〜
417_72ki
1
46
The history of entry-point in iOS app Development
417_72ki
0
420
R.swift to Asset Symbols
417_72ki
0
310
Refactor with using `available` and `deprecated`
417_72ki
3
660
CLIツールにSwift Concurrencyを適用させようとしている話
417_72ki
3
440
CI with Danger-Swift
417_72ki
1
210
Graduation from Playground beginner
417_72ki
3
930
Trap Questions in Java and Obj-C
417_72ki
1
310
Other Decks in Programming
See All in Programming
Cursor/Devin全社導入の理想と現実
saitoryc
28
21k
KawaiiLT 登壇資料 キャリアとモチベーション
hiiragi
0
160
Creating Awesome Change in SmartNews! En
martin_lover
0
110
AI時代の開発者評価について
ayumuu
0
230
開発者フレンドリーで顧客も満足?Platformの秘密
algoartis
0
160
Thank you <💅>, What's the Next?
ahoxa
1
590
Boost Your Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
750
今話題のMCPサーバーをFastAPIでサッと作ってみた
yuukis
0
110
カオスに立ち向かう小規模チームの装備の選択〜フルスタックTSという装備の強み _ 弱み〜/Choosing equipment for a small team facing chaos ~ Strengths and weaknesses of full-stack TS~
bitkey
1
130
プロダクトエンジニアのしごと 〜 受託 × 高難度を乗り越えるOptium開発 〜
algoartis
0
150
Optimizing JRuby 10
headius
0
560
The Missing Link in Angular’s Signal Story: Resource API and httpResource
manfredsteyer
PRO
0
140
Featured
See All Featured
Making Projects Easy
brettharned
116
6.2k
Six Lessons from altMBA
skipperchong
28
3.7k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
5
550
Why Our Code Smells
bkeepers
PRO
336
57k
GraphQLの誤解/rethinking-graphql
sonatard
71
10k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
410
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.6k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
2.7k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
690
Producing Creativity
orderedlist
PRO
344
40k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.7k
Transcript
.PDLBCMF6TFS%FGBVMUT XJUI %VDLUZQJOH QPUBUPUJQT
struct Me { let name = "Takuhiro Muta" let aka
= "417.72KI" let experienceYears = 5 let company = "iRidge inc." let twitter = "417_72ki" let qiita = "417_72ki" let gitHub = "417-72KI" let products = [ "BuildConfig.swift", "MockUserDefaults", ] } TFMGEFTDSJQUJPO
%VDL5ZQJOH
%VDL5ZQJOH w 0OFPGUIFNFUIPETUPJNQMFNFOU QPMZNPSQIJTN w 6TFEJOEZOBNJDMBOHVBHFT FH3VCZ 1ZUIPO w
0CKFDUTTVJUBCJMJUZJTEFUFSNJOFECZUIF QSFTFODFPGDFSUBJONFUIPETBOE QSPQFSUJFT w /PUPCKFDU`TPXOUZQF
r%BWF5IPNBT l*GJUXBMLTMJLFBEVDLBOERVBDLTMJLFB EVDL JUNVTUCFBEVDLz
%VDL5ZQJOH class Duck: def walk(self): print("Duck walking") def quack(self): print("Quack!!")
class Dog: def walk(self): print("Dog walking") def bark(self): print("Bark!!") def walk_and_quack(animal): animal.walk() animal.quack()
%VDL5ZQJOH class Duck: def walk(self): print("Duck walking") def quack(self): print("Quack!!")
class Dog: def walk(self): print("Dog walking") def bark(self): print("Bark!!") def walk_and_quack(animal): animal.walk() animal.quack()
%VDL5ZQJOH class Duck: def walk(self): print("Duck walking") def quack(self): print("Quack!!")
class Dog: def walk(self): print("Dog walking") def bark(self): print("Bark!!") def walk_and_quack(animal): animal.walk() animal.quack()
%VDL5ZQJOH class Duck: def walk(self): print("Duck walking") def quack(self): print("Quack!!")
class Dog: def walk(self): print("Dog walking") def bark(self): print("Bark!!") def walk_and_quack(animal): animal.walk() animal.quack()
%VDL5ZQJOH walk_and_quack(Duck()) # Duck walking # Quack!! walk_and_quack(Dog()) # Dog
walking # AttributeError: 'Dog' object has # no attribute 'quack'
*O0CK$ @interface Duck: NSObject - (void)walk; - (void)quack; @end @implementation
Duck - (void)walk { NSLog(@"Duck walking"); } - (void)quack { NSLog(@"Quack!!"); } @end void walkAndQuack(id animal) { [animal walk]; [animal quack]; }
*O0CK$ @interface Duck: NSObject - (void)walk; - (void)quack; @end @implementation
Duck - (void)walk { NSLog(@"Duck walking"); } - (void)quack { NSLog(@"Quack!!"); } @end void walkAndQuack(id animal) { [animal walk]; [animal quack]; }
*O0CK$ @interface Duck: NSObject - (void)walk; - (void)quack; @end @implementation
Duck - (void)walk { NSLog(@"Duck walking"); } - (void)quack { NSLog(@"Quack!!"); } @end void walkAndQuack(id animal) { [animal walk]; [animal quack]; }
*O0CK$ walkAndQuack([Duck new]); // Duck walking // Quack!! walkAndQuack([Dog new]);
// Dog walking // unrecognized selector sent to instance
)PXUPNPDL 6TFS%FGBVMUT
r%BWF5IPNBT l*GJUXBMLTMJLFBEVDLBOERVBDLTMJLFB EVDL JUNVTUCFBEVDLz
l*GJUTBWFTPCKFDUTMJLF6TFS%FGBVMT BOEMPBETPCKFDUTMJLF6TFS%FGBVMUT JUNVTUCF6TFS%FGBVMUTz
%FpOFBMMNFUIPETJO /46TFS%FGBVMUT
%FpOFBMMNFUIPETJO /46TFS%FGBVMUT /PUFYUFOE/46TFS%FGBVMUT
*NQMFNFOU
%FpOFFYUFOTJPOUPVTFJU BT/46TFS%FGBVMUT
%FpOFFYUFOTJPOUPVTFJU BT/46TFS%FGBVMUT
%FpOFFYUFOTJPOUPVTFJU BT/46TFS%FGBVMUT ⁉
None
5IBOLZPV IUUQTHJUIVCDPN,*.PDL6TFS%FGBVMUT