You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
each TDependency represents a "parameter pack"; the number of generic arguments to this initializer is variable. With this overload, one can say:
Service(.transient,FooProtocol.self,Foo.init)
I tested this locally and it works without confusing the compiler on existing registrations. However, I tested this on Linux, so I had to disable everything related to SwiftUI/Combine. I don't have a Mac to test those parts myself.
Value
The Factory.register blocks would become shorter, making them easier to read and write. Most callbacks passed to the Service are just an initializer.
Something similar could be done for MultitypeService.
The text was updated successfully, but these errors were encountered:
I just read up on all of the new features in 5.9. As far as the feature request goes, this definitely seems like an ideal use case for variadic generics and gets rid of a lot of boiler plate code.
I haven't updated to Xcode 15 yet! I'm always a little hesitant to update to X.0 releases, but I'm sure I'll end up updating soon enough (whether that's on purpose or not...).
I'll let you know when I do so I can fully test everything related to SwiftUI/Combine.
Checklist
Problem
When a single type has a lot of dependencies, the registration gets long and repetitive, and is fragile to changing the init:
Feature Request
As of Swift 5.9 (Xcode 15), we can add an overload like this:
each TDependency
represents a "parameter pack"; the number of generic arguments to this initializer is variable. With this overload, one can say:I tested this locally and it works without confusing the compiler on existing registrations. However, I tested this on Linux, so I had to disable everything related to SwiftUI/Combine. I don't have a Mac to test those parts myself.
Value
The
Factory.register
blocks would become shorter, making them easier to read and write. Most callbacks passed to theService
are just an initializer.Something similar could be done for
MultitypeService
.The text was updated successfully, but these errors were encountered: