Created
November 4, 2019 04:05
-
-
Save fmo91/2e292c4e8813ccca7bccedd5a916ae82 to your computer and use it in GitHub Desktop.
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
enum Dependencies { | |
// ... | |
@propertyWrapper | |
struct Inject<T> { | |
private let dependencyName: Name | |
private let container: Container | |
var wrappedValue: T { | |
get { container.resolve(dependencyName) } | |
} | |
init(_ dependencyName: Name = .default, on container: Container = .default) { | |
self.dependencyName = dependencyName | |
self.container = container | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment