https://github.com/devxoul/swinjectsafeauto
SwinjectSafeAuto allows to auto-register services to the container and verify the required services are properly registered.
https://github.com/devxoul/swinjectsafeauto
Last synced: 3 months ago
JSON representation
SwinjectSafeAuto allows to auto-register services to the container and verify the required services are properly registered.
- Host: GitHub
- URL: https://github.com/devxoul/swinjectsafeauto
- Owner: devxoul
- License: mit
- Created: 2020-09-30T20:08:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-16T17:46:08.000Z (over 4 years ago)
- Last Synced: 2025-02-18T19:40:16.282Z (4 months ago)
- Language: Swift
- Size: 10.7 KB
- Stars: 15
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SwinjectSafeAuto
SwinjectSafeAuto allows to auto-register services to the container and verify the required services are properly registered.
This project is inspired by [SwinjectAutoregistration](https://github.com/Swinject/SwinjectAutoregistration).
## Features
* Auto-register services to the container.
* Verify that required services are properly registered to the container.## Usage
```swift
container.autoregister(NetworkingProtocol.self, initializer: Networking.init)
container.autoregister(MyServiceProtocol.self, initializer: MyService.init)// This method will throw an error in DEBUG build when the required services are not properly reigstered.
try! container.verify()// You can safely resolve services after verification.
container.resolve(MyServiceProtocol.self)
```## Limitation
* SwinjectSafeAuto cannot verify manually-registered services using `container.register()`.
* SwinjectSafeAuto cannot be used with [SwinjectAutoregistration](https://github.com/Swinject/SwinjectAutoregistration) in the same project.## License
SwinjectSafeAuto is under MIT license. See the [LICENSE](LICENSE) file for more info.