Factory: Swift Dependency Injection

A new approach to an old problem.

Michael Long
Better Programming
Published in
9 min readJun 6, 2022

--

Why do something new?

The first dependency injection system I ever wrote was Resolver. This open source project, while quite powerful and still in use in many applications, suffers from a few drawbacks.

  1. Resolver requires pre-registration of all service factories up front.

--

--

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.