-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
When registering an optional property, it can not be resolved by the property wrapper even when it's available (not nil).
Example:
class Foo {
@Inject var bar: Int?
}
container.register(Int?.self) { _ in
return 42
}.inObjectScope(.container)
From the docs I assume this should be supported and I have also seen an init created for Optionals, however that init is not used. I am not sure I fully understand the rationale behind how this generic init (on line 28) is supposed to work, but I believe for optional properties to resolve properly, the wrappedValue should be of an optional type as well or the Wrapped type should be passed as an argument to the generic init method, otherwise it is not used anywhere in the method body.
Looking forward to your reply, thanks.
Metadata
Metadata
Assignees
Labels
No labels