Dependency Injection with Resolver

Episode #460 | 23 minutes | published on September 11, 2020 | Uses Swift-5.2, Xcode-12-beta6
Subscribers Only
Managing dependencies can be a pain. Unless you're using shared instances accessible everywhere, you end up having to pass along dependencies from class to class. One strategy for decoupling your types from external dependencies is to create protocols and "inject" the actual concrete implementations at runtime. This enables you to test them easily and also isolates library-specific APIs from the rest of your application. This can make switching between libraries more feasible. In this episode we'll take a look at a library called Resolver that does this. Technically it implements Service Location rather than Dependency Injection, but the result is similar.
blog comments powered by Disqus