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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
180
Furlenco's AR Journey
swiftindia
0
160
Image processing using Core Image and Metal
swiftindia
0
270
Combine - Diving into Apple’s Reactive Programming
swiftindia
1
310
Social in Hotstar
swiftindia
0
280
Improving App Launch Time
swiftindia
1
160
Backend Driven UIs
swiftindia
0
160
Other Decks in Programming
See All in Programming
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
150
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
230
Webの地図
yosuke_furukawa
PRO
6
4.3k
Family mrubyの進捗
kishima
1
110
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
56
38k
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
170
Foundry Localでエージェント開発
seosoft
0
190
【DroidKaigi 2026】「アクセシビリティを利用するとき、 アクセシビリティもまたこちらを利用している」 〜マルウェアによる攻撃と防衛について〜
halunoyo
0
450
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
310
Java 27新機能 / Java 27 new features
kishida
2
110
Jetpack Compose メカニズム
skydoves
0
290
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Writing Fast Ruby
sferik
630
63k
Tell your own story through comics
letsgokoyo
1
1.1k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
520
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
500
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
460
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
980
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
A designer walks into a library…
pauljervisheath
211
25k
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?