Michael Long
Aug 14, 2023

--

As always, I'm interested in seeing different approaches to dependency injection and I thought from the title that AppContainer might be something new.

Unfortunately, this is basically just an overview of using Swinject for DI.

As an introduction it's not bad, but I'd question the use of:

let container = AppContainer.default

As that basically devolves this into being a service locator pattern and makes everything dependent on a global singleton.

If you're doing a true container-based system you probably need to pass the container into the object's initializer.

--

--

Michael Long
Michael Long

Written by Michael Long

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.

Responses (3)