Modern Dependency Injection in Swift
Tips, techniques, and strategies for getting the most from your dependency-injection system in iOS applications
MVVM. MVP. VIPER. Clean. In modern iOS applications, we often use a specific architecture or design pattern to break our software down into individual components that are easy to read and understand and that are easy to test.
But breaking applications down into individual components creates its own problem. Just how do we put our application back together again?
How does ViewController x find out about ViewModel m, and, for that matter, just how does ViewModel m get everything that it needs to do its job?
There are several possible solutions to that problem, but today we’re going to look into some advanced techniques based on dependency injection and using a dedicated dependency-injection system.
You may already be doing this in some way, shape, or form, but in this article, we’re going to dive into some of the techniques I wish I’d known before I started using a dependency-injection system in my first application.
We’ll demonstrate those techniques using Resolver, a modern dependency-injection system. But don’t worry. The tips and strategies we’re going to discuss can be…