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
370
Refactor with using `available` and `deprecated`
417_72ki
3
800
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
Symfonyの特性(設計思想)を手軽に活かす特性(trait)
ickx
0
130
感情を設計する
ichimichi
5
1.3k
Redox OS でのネームスペース管理と chroot の実現
isanethen
0
550
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
130
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
110
How Swift's Type System Guides AI Agents
koher
0
170
의존성 주입과 모듈화
fornewid
0
110
Nuxt Server Components
wattanx
0
250
実践CRDT
tamadeveloper
0
350
AIエージェントで業務改善してみた
taku271
0
490
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
340
KagglerがMixSeekを触ってみた
morim
0
370
Featured
See All Featured
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
150
Evolving SEO for Evolving Search Engines
ryanjones
0
170
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
500
The Cult of Friendly URLs
andyhume
79
6.8k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.3k
HDC tutorial
michielstock
1
610
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Claude Code のすすめ
schroneko
67
220k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.7k
The agentic SEO stack - context over prompts
schlessera
0
730
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
250
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