This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
Adds Dependency Injection mechanism and change protocol conformance #28
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 aims to achieve a mechanism to provide dependencies to VIPER modules.
The
createModule
method ofRouter
class receives aServiceLocator
object as argument. This object provides all the dependencies of the app and will be used to provides dependencies of the module.In this way, the service locator object is passed between modules.
An example of ServiceLocator implementation can be found here
Apart from these modifications, I have moved the implementation of some protocols to extensions in order to improve legibility (https://github.com/raywenderlich/swift-style-guide#protocol-conformance)
I understand that this pull request tie the user to use the proposed dependency injection mechanism, so I will understand that the PR will be rejected. Anyway, I hope it will be useful for someone.
Thanks!