Swiftpack.co - Christopher-Thiebaut/Container as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Christopher-Thiebaut.
Christopher-Thiebaut/Container v0.2.0
A simple Swift dependency injection package based on property wrappers and reflection.
⭐️ 0
🕓 3 years ago
.package(url: "https://github.com/Christopher-Thiebaut/Container.git", from: "v0.2.0")

Container

Container is a runtime dependency injection framework written in Swift, written with developer ergonomics in mind.

The major goals of this project are enabling greater developer ergonomics, making the easy choice the right choice, and ensuring that code that relies on Container is fully testable.

As such, there's no singleton or shared instance of Container that's accessible throughout your app. Just use the @Containerized property wrapper to say your object is expecting to receive its dependencies from some Container, and then you free your objects from having to worry about transitive dependencies or passing dependencies through 5 layers of initializers.

Then, just initialize the root of your object graph and pass it to container.fill to automagically associate the Container with your object and all of its descendants. At the same time, you can easily test your object in isolation because each test can have its own instance of Container that is used to initialize the subject under test.

GitHub

link
Stars: 0
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Fix crash if object in dependency graph has reference cycle
3 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics