-
-
Notifications
You must be signed in to change notification settings - Fork 197
Update 1.5.4 #185
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
Update 1.5.4 #185
Conversation
- @injected → @ResolverInjected - @OptionalInjected → @ResolverOptionalInjected - @LazyInjected → @ResolverLazyInjected - @WeakLazyInjected → @ResolverWeakLazyInjected - @InjectedObject → @ResolverInjectedObject This resolves naming conflicts with the Factory DI framework when both are used together.
0x0sky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, but take a look at the comments — there’s a genuine intention to help polish this.
| } | ||
|
|
||
|
|
||
| class InjectedCyclicA { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why didn't you use a 'final' keyword?
'
Swift gives us a final keyword just for this purpose: when you declare a class as being final, no other class can inherit from it. This means they can’t override your methods in order to change your behavior – they need to use your class the way it was written.
'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting that those are tests and not part of the library per se.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You were right+ It was only later that I noticed the word test!
| @ResolverInjected(name: "fred") var service: XYZNameService | ||
| } | ||
|
|
||
| class NamedInjectedViewController2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
y didn’t you use the final keyword here (if it isn’t already inherited)?
| @discardableResult | ||
| public static func register<Service>(_ type: Service.Type = Service.self, name: Resolver.Name? = nil, | ||
| factory: @escaping ResolverFactory<Service>) -> ResolverOptions<Service> { | ||
| factory: @escaping ResolverFactorySendable<Service>) -> ResolverOptions<Service> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line-break
|
|
||
| class ContainerInjectedViewController { | ||
| @Injected(container: .custom) var service: XYZNameService | ||
| @ResolverInjected(container: .custom) var service: XYZNameService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this outside the class?
In Ruby, I’d usually keep properties as isolated as possible.
Swift tends to rely more on access-level modifiers.
|
Several things. First, Resolver is deprecated in favor of Factory. Second, renaming major components is a breaking change and would be outside of a point release. Third, and in light of the first two cases, I see no need to use both libraries in the same project. |
rename property wrappers to avoid clash with Factory ones