Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Dependency Injection by Aadithya at SwiftDelhi
Search
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
130
Image processing using Core Image and Metal
swiftindia
0
220
Combine - Diving into Apple’s Reactive Programming
swiftindia
1
250
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
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
490
20 years of Symfony, what's next?
fabpot
2
370
Rubyで鍛える仕組み化プロヂュース力
muryoimpl
0
140
AIコーディングエージェント(skywork)
kondai24
0
180
複数人でのCLI/Infrastructure as Codeの暮らしを良くする
shmokmt
5
2.3k
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
130
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
440
マスタデータ問題、マイクロサービスでどう解くか
kts
0
110
sbt 2
xuwei_k
0
300
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
230
認証・認可の基本を学ぼう後編
kouyuume
0
240
Flutter On-device AI로 완성하는 오프라인 앱, 박제창 @DevFest INCHEON 2025
itsmedreamwalker
1
120
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.8k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
390
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
1k
Producing Creativity
orderedlist
PRO
348
40k
We Have a Design System, Now What?
morganepeng
54
7.9k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Designing Experiences People Love
moore
143
24k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.7k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
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?