Objective-C Dependency Injection Framework Using A Spring-Style Approach

If you’ve been looking for a dependency injection framework here’s an interesting project submitted by Jasper Blues called Spring Objective-C.

As you can likely guess by the name the syntax is inspired by the Spring framework  on the Java platform.

Jasper explains in the readme why he chose to go with the Spring-style approach:

– Allows both dependency injection (injection of classes defined in the DI context) as well as configuration management (values that get converted to the required type at runtime).
– Application assembly – the wiring of dependencies and configuration management – is all encapsulated in a convenient document.
– Encourages polymorphism and makes it easy to have multiple implementations of the same base-class or protocol. For example, let’s say you have a music store application that depends on a payment engine. Spring-style makes it easy to define both a master-card payment engine or a visa payment engine.
– Supports dependency injection by type (definitions satisfying a class or protocol) as well as by reference.
– Also supports “annotation” (aka Macro) and code/DSL style injection.

You can find Spring Objective-C through Github here.

You’ll find an extensive example on the Github page.

DeliciousTwitterFacebookRedditLinkedInEmail

Original article: Objective-C Dependency Injection Framework Using A Spring-Style Approach

©2013 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *