paint-brush
Swift Dependency Injection With Functionsby@twittemb
498 reads
498 reads

Swift Dependency Injection With Functions

by Thibault Wittemberg7mAugust 20th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Dependency injection is a technique at the crossroads of well known software engineering best practices: abstraction and decoupling, single responsibility, dependency inversion. It provides flexible and testable implementations of higher order free functions. This article assumes that the merits of dependency injection are accepted. We will see how dependency injection and higher order functions fit very well together. The UsersRepository is injected with an ApiService protocol whose purpose is to fetch users from the Rest endpoints. The repository doesn’t care about where they come from, it is an implementation detail. The publisher should only be built if and when needed.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Swift Dependency Injection With Functions
Thibault Wittemberg HackerNoon profile picture
Thibault Wittemberg

Thibault Wittemberg

@twittemb

Mobile Architect in Montreal

About @twittemb
LEARN MORE ABOUT @TWITTEMB'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Thibault Wittemberg HackerNoon profile picture
Thibault Wittemberg@twittemb
Mobile Architect in Montreal

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite