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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Swift India
July 16, 2017
Programming
90
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
170
Furlenco's AR Journey
swiftindia
0
160
Image processing using Core Image and Metal
swiftindia
0
260
Combine - Diving into Apple’s Reactive Programming
swiftindia
1
290
Social in Hotstar
swiftindia
0
270
Improving App Launch Time
swiftindia
1
150
Backend Driven UIs
swiftindia
0
150
Other Decks in Programming
See All in Programming
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
530
Oxcを導入して開発体験が向上した話
yug1224
4
310
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
530
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
680
The NotImplementedError Problem in Ruby
koic
1
710
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.6k
LLM Plugin for Node-REDの利用方法と開発について
404background
0
170
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.4k
Modding RubyKaigi for Myself
yui_knk
0
920
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.2k
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
20
6.5k
CSC307 Lecture 17
javiergs
PRO
0
320
Featured
See All Featured
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
160
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
Optimising Largest Contentful Paint
csswizardry
37
3.7k
Believing is Seeing
oripsolob
1
140
HDC tutorial
michielstock
2
700
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
130
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
210
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
410
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
840
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
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?