Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
140
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
250
Improving App Launch Time
swiftindia
1
110
Backend Driven UIs
swiftindia
0
130
Other Decks in Programming
See All in Programming
エディターってAIで操作できるんだぜ
kis9a
0
540
アーキテクチャと考える迷子にならない開発者テスト
irof
9
3.4k
All(?) About Point Sets
hole
0
240
CSC305 Lecture 15
javiergs
PRO
0
220
Web エンジニアが JavaScript で AI Agent を作る / JSConf JP 2025 sponsor session
izumin5210
4
2.1k
JJUG CCC 2025 Fall Javaコミュニティの歩き方 〜参加から貢献まで、すべて教えます〜
takasyou
0
700
しっかり学ぶ java.lang.*
nagise
1
470
ZOZOにおけるAI活用の現在 ~モバイルアプリ開発でのAI活用状況と事例~
zozotech
PRO
8
3.7k
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
10
10k
配送計画の均等化機能を提供する取り組みについて(⽩⾦鉱業 Meetup Vol.21@六本⽊(数理最適化編))
izu_nori
0
110
WebRTC と Rust と8K 60fps
tnoho
2
1.7k
モデル駆動設計をやってみよう Modeling Forum2025ワークショップ/Let’s Try Model-Driven Design
haru860
0
210
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
40
2.2k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.2k
Git: the NoSQL Database
bkeepers
PRO
432
66k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
11
950
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Large-scale JavaScript Application Architecture
addyosmani
514
110k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.6k
Site-Speed That Sticks
csswizardry
13
980
The Cost Of JavaScript in 2023
addyosmani
55
9.3k
Thoughts on Productivity
jonyablonski
73
4.9k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
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?