Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Dependency Injection by Aadithya at SwiftDelhi
Search
Swift India
July 16, 2017
Programming
93
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Dependency Injection by Aadithya at SwiftDelhi
Dependency Injection by Aadithya at SwiftDelhi
Swift India
July 16, 2017
More Decks by Swift India
See All by Swift India
Network Layer Abstraction
swiftindia
0
190
Efficient JSON to Object Parsing
swiftindia
0
180
Sign In with Apple
swiftindia
0
190
Furlenco's AR Journey
swiftindia
0
170
Image processing using Core Image and Metal
swiftindia
0
270
Combine - Diving into Apple’s Reactive Programming
swiftindia
1
320
Social in Hotstar
swiftindia
0
280
Improving App Launch Time
swiftindia
1
170
Backend Driven UIs
swiftindia
0
160
Other Decks in Programming
See All in Programming
Jetpack Compose Mechanisms
skydoves
3
820
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
5
5.1k
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
140
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
430
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.7k
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
残高管理から台帳サービスへの進化
artoy
1
200
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
960
気持ちぃ〜角丸 Squircle
ryu1013
0
310
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
170
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
96
14k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
エンジニアに許された特別な時間の終わり
watany
109
250k
Producing Creativity
orderedlist
PRO
348
41k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
850
Why Our Code Smells
bkeepers
PRO
340
58k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
330
Building the Perfect Custom Keyboard
takai
2
910
Utilizing Notion as your number one productivity tool
mfonobong
4
620
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
530
Transcript
Dependency Injection Adithya Reddy iOS engineer at UrbanClap
What. Why. How.
What is dependency Injection? It’s a fancy name for a
fairly simple concept.
Is DI used in this code snippet below? NO
What about this? YES
And this? NO
Traditional way: Race car Engine Transmission Piston Shaft Clutch Flywheel
Dependency injection way: Race car Engine Transmission Piston Shaft Clutch
Flywheel
Why use dependency Injection? 3 C’s Clarity Customizability Concerns
Clarity Callers need to know only about one thing, i.e.
initializer init() is clean and not dumped with constructors No unexpected behavior Example: if a new person joins the team, he need not go throught the viewcontroller to find the dependent objects in it. He just needs to look at init and inject.
Customizability Have control over which implementation to use. For example:
I can plug in Engine with FastEngine without worrying much Also, highly useful in testing. X1 in debug mode and X2 in release mode.
Concerns Race car is just a race car. Need not
worry about the configuration of other parts. Specific purposes lying in each component Allows composing instead of subclassing
Constructor injection vs Setter injection Constructor injection : use when
values dont change Setter injection : use when required. When you want to set the dependencies via properties
How to setup and use dependency injection? Now, I will
demonstrate how to integrate the Typhoon framework to achieve DI. Concept of Assemblies
Coming back… Now… you must be able to answer why
the code snippet below doesnt confirm to DI...
Why does this confirm to DI?
And finally, why doesnt this confirm to DI?