Dependency injection as a design pattern can manifest in different ways - from passing dependencies at initialisation to service locators and 3rd party libraries. (here’s a nice
overview of the good old ways from 2019 by
@kofse)
Inspired by SwiftUI’s @Enviroment
, nowadays dependency injection can be made simpler and easier to use, thanks to Swift’s latest features such as static subscripts, extensions, and property wrappers: