Swift • Maintained by 5 members • 1.4k+ stars on GitHub • Supporting iOS, macOS, tvOS, watchOS and Linux • 4 extensions provided • github.com/Swinject/Swinject
You create what you use. ↺ What you use are created and passed. - Initializer Injection (Constructor Injection) - Property Injection - Method Injection Three ways to pass a dependency instance
*NQMFNFOUBUJPO $PODSFUF5ZQF &YUFSOBM4ZTUFN OFUXPSL pMFTZTUFN EBUFUJNF SBOEPNOVN *NQMFNFOUBUJPO $PODSFUF5ZQF &YUFSOBM4ZTUFN *OUFSGBDF 1SPUPDPM Hard to test
*NQMFNFOUBUJPO $PODSFUF5ZQF &YUFSOBM4ZTUFN OFUXPSL pMFTZTUFN EBUFUJNF SBOEPNOVN *NQMFNFOUBUJPO $PODSFUF5ZQF &YUFSOBM4ZTUFN *OUFSGBDF 1SPUPDPM .PDL Hard to test Easy to test
of definitions checked by compiler. • Cons - Less easy than DI container. %FQFOEFODZ*OKFDUJPOXJUIUIF$BLF1BUUFSOJO4XJGUCZ#PC$PUUSFMM IUUQBDRVJIJSFNFEFQFOEFODZJOKFDUJPOXJUIUIFDBLFQBUUFSOJOTXJGU (SFBUBSUJDMFUPMFBSO$BLF1BUUFSO