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
Dependency Injection by Aadithya at SwiftDelhi
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Swift India
July 16, 2017
Programming
0
77
Dependency Injection by Aadithya at SwiftDelhi
Dependency Injection by Aadithya at SwiftDelhi
Swift India
July 16, 2017
Tweet
Share
More Decks by Swift India
See All by Swift India
Network Layer Abstraction
swiftindia
0
170
Efficient JSON to Object Parsing
swiftindia
0
150
Sign In with Apple
swiftindia
0
150
Furlenco's AR Journey
swiftindia
0
140
Image processing using Core Image and Metal
swiftindia
0
230
Combine - Diving into Apple’s Reactive Programming
swiftindia
1
270
Social in Hotstar
swiftindia
0
260
Improving App Launch Time
swiftindia
1
120
Backend Driven UIs
swiftindia
0
140
Other Decks in Programming
See All in Programming
Apache Iceberg V3 and migration to V3
tomtanaka
0
170
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
CSC307 Lecture 09
javiergs
PRO
1
840
CSC307 Lecture 10
javiergs
PRO
1
660
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
610
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
Fluid Templating in TYPO3 14
s2b
0
130
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
組織で育むオブザーバビリティ
ryota_hnk
0
180
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
210
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
200
2026年 エンジニアリング自己学習法
yumechi
0
140
Featured
See All Featured
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
380
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
94
Testing 201, or: Great Expectations
jmmastey
46
8.1k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
180
Java REST API Framework Comparison - PWX 2021
mraible
34
9.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
270
How to Ace a Technical Interview
jacobian
281
24k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
130
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?