A simple Swift dependency injection container that uses protocols to resolve dependencies and avoid singletons.
Dip is a dependency injection container for Swift that allows developers to register and resolve dependencies using protocols, eliminating the need for singletons or shared instances. It simplifies managing object lifecycles and promotes loose coupling between components in Swift applications.
Swift developers building iOS, macOS, or Linux applications who want to improve testability and maintainability through dependency injection.
Developers choose Dip for its simplicity, rich feature set inspired by .NET's Unity Container, and seamless integration with Swift's protocol-oriented paradigm, making it a lightweight yet powerful alternative to manual dependency management.
Simple Swift Dependency container. Use protocols to resolve your dependencies and avoid singletons / sharedInstances!
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports five scopes including Singleton and Shared, providing fine-grained control over dependency lifetimes without manual implementation.
Auto-wiring and auto-injection reduce boilerplate by inferring and resolving constructor and property dependencies automatically, as highlighted in the wiki.
Works with Storyboards and Nibs without cluttering view controller code, enabling clean dependency injection in UI-heavy iOS apps.
Manages circular dependencies with simple configuration rules, easing complex object graph management that can arise in modular architectures.
Requires explicit registration of all dependencies, which can be verbose and error-prone without the optional dipgen code generator, adding setup complexity.
Lacks compile-time safety for dependency resolution, potentially leading to runtime errors if registrations are incorrect or missing, despite helpful error messages.
Primarily designed for UIKit and Storyboards, making integration with SwiftUI less straightforward compared to environment-based DI solutions.