This story on HackerNoon has a decentralized backup on Sia.
Transaction ID: ltVtq69zhwAgkY7Ba26O1yfqB3VWA7lMuSetuKhjhS4
Cover

Swift Dependency Injection With Functions

Written by @twittemb | Published on 2020/8/20

TL;DR
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.

[story continues]


Written by
@twittemb
Mobile Architect in Montreal

Topics and
tags
swift|dependency-injection|functional-programming|higher-order-functions|code-quality|testing|software-development|software-engineering
This story on HackerNoon has a decentralized backup on Sia.
Transaction ID: ltVtq69zhwAgkY7Ba26O1yfqB3VWA7lMuSetuKhjhS4