質問

Once I read in some google document about coding guidelines that every new instance of a class should go from a factory class, and I use SwiftSuspenders for it.

Now my question is, is it possible to create a new instance of an object that requires constructor parameters using SS's dependency injection?

役に立ちましたか?

解決

Yes, Swiftsuspenders fully supports constructor injection.

You can either inject into a field (or a method or another constructor) requiring an instance of your class, or you can use injector.getInstance to directly query the injector for an instance that's created using the injector's mappings.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top