-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced Dependency Injection Functionality and Documentation #6
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Added a private `default` property to the Container class. - Modified the initializer of Container to accept a `default` value. - Updated the `wrappedValue` property to return a default value if available, otherwise throwing a fatal error when resolution fails. - Extended DIContainerTests with a new test case `testWrapperInjectWithDefaultValueByStructType` to validate the new functionality.
- Changed the swift-tools-version from 5.3 to 5.9 in Package.swift.
- Enhanced `InjectIdentifier.swift` with documentation comments, added `Hashable` conformance, and public extension for creating identifiers. - Updated `DIContainer.swift` with detailed documentation for the `Resolvable` protocol, `ResolvableError` enum, and `Injectable` protocol. - Added comprehensive documentation and refactored code in `Container.swift`, including changes to `Injected` and `InjectedSafe` property wrappers for clearer error handling and dependency resolution. - Improved code readability and maintainability across all modified files.
…tainer into default-injectable-value
Code Climate has analyzed commit aa641d5 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 93.9% (50% is the threshold). This pull request will bring the total coverage in the repository to 92.1% (1.3% change). View more on Code Climate. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several significant improvements to the DIContainer module, focusing on enhancing its dependency injection functionality, refining code structure, and adding comprehensive documentation for better clarity and maintainability.
Changes
InjectIdentifier Refactoring and Documentation
File:
InjectIdentifier.swift
InjectIdentifier
.InjectIdentifier
to conform to theHashable
protocol, ensuring unique identification of dependencies.InjectIdentifier
instances.DIContainer Enhancements and Documentation
File:
DIContainer.swift
Resolvable
protocol, clarifying its role in resolving dependencies.ResolvableError
to encapsulate errors during dependency resolution, with comprehensive documentation.Injectable
protocol, detailing each function and its purpose in dependency management.Container Class Refinements
File:
Container.swift
Container
as a singleton for managing dependencies across the application.Injected
andInjectedSafe
property wrappers for improved error handling and clearer dependency resolution logic.Package.swift Swift Tools Version Update
File:
Package.swift
Impact
These changes enhance the DIContainer's functionality, making it more robust and user-friendly. The added documentation significantly improves the understandability of the code, facilitating easier maintenance and future enhancements. The update in Swift tools version aligns the module with current Swift standards.
Testing
testWrapperInjectWithDefaultValueByStructType
to validate the new functionality of injecting default values.This PR aims to provide a more robust and well-documented DIContainer module, aligning with best practices and current Swift standards. The enhancements are expected to improve the efficiency and reliability of dependency injection in Swift projects.