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
1.3k
0
Share
Mockable UserDefaults with Duck typing
417.72KI
June 18, 2019
More Decks by 417.72KI
See All by 417.72KI
Comparing decimals in Swift Testing
417_72ki
0
230
Reboot a personal app abandoned for 10 years with recent techs
417_72ki
0
110
iTunes・おぼえていますか〜ScriptingBridge今昔物語〜
417_72ki
1
190
The history of entry-point in iOS app Development
417_72ki
0
500
R.swift to Asset Symbols
417_72ki
0
380
Refactor with using `available` and `deprecated`
417_72ki
3
810
CLIツールにSwift Concurrencyを適用させようとしている話
417_72ki
3
500
CI with Danger-Swift
417_72ki
1
270
Graduation from Playground beginner
417_72ki
3
1k
Other Decks in Programming
See All in Programming
2026-04-15 Spring IO - I Can See Clearly Now
jonatan_ivanov
1
130
書き換えて学ぶTemporal #fukts
pirosikick
1
230
Vibe NLP for Applied NLP
inesmontani
PRO
0
520
CDK Deployのための ”反響定位”
watany
5
900
Making the RBS Parser Faster
soutaro
0
600
Don't Prompt Harder, Structure Better
kitasuke
0
790
Back to the roots of date
jinroq
0
530
TiDBのアーキテクチャから学ぶ分散システム入門 〜MySQL互換のNewSQLは何を解決するのか〜 / tidb-architecture-study
dznbk
1
200
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1k
ドメインイベントでビジネスロジックを解きほぐす #phpcon_odawara
kajitack
3
830
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
290
AI-DLC Deep Dive
yuukiyo
9
5k
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
430
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
120
Music & Morning Musume
bryan
47
7.2k
[SF Ruby Conf 2025] Rails X
palkan
2
980
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
180
We Are The Robots
honzajavorek
0
220
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
240
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
270
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
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