Deprecated Swift dependency injection and service locator framework, replaced by Factory
open sourceMITfree
Resolver is a lightweight dependency injection and service locator framework for Swift on iOS, implemented in one file of about 700 lines. It supports interface, property, constructor and method injection, service location and property-wrapper annotations (@Injected, @LazyInjected, @InjectedObject for SwiftUI), with automatic type inference, scopes, named instances, argument passing and nested containers. Its author, Michael Long, has deprecated it and replaced it with Factory, a compile-time safe container-based system.
Problems it solves
- inject services into my iOS view controllers without passing them through every initializer
- swap real services for mocks in Swift tests
- share one instance of a service across my iOS app
Features
- constructor, property, method and interface injection
- service locator
- @Injected property wrappers, including @InjectedObject for SwiftUI
- scopes: application, cached, graph, shared and unique
- named instances and argument passing
- custom and nested containers
Limitations
- Deprecated by its author in favour of Factory.1
Alternatives
The same job
These do what Resolver does.
- Factory (Swift) Container-based dependency injection for Swift and SwiftUI
- swift-dependencies A Swift dependency management library inspired by SwiftUI's environment
