Dependency injection using factories in Swift

www.swiftbysundell.com

Dependency injection is an essential tool when it comes to making code more testable. Instead of having objects either create their own dependencies or access them as singletons, it's the idea that everything an object needs in order to do its work should be passed in from the outside. This both makes it easier to see what exact dependencies a given object has, and it also makes testing a lot simpler - since dependencies can be mocked in order to capture and verify state & values.

Read more...
Linkedin

Want to receive more content like this in your inbox?