Get Updates By E-mail 

Article Written By:
Johann Dowa

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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments