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.
- Tool: Objective-C Dependency Graphing Script For Easily Improving Program Design
- Open Source JSON Based Data Model Framework
- Best Resources In iOS Development – December 26th, 2011
- New Open Source Visual iOS Testing Framework For Easy Testing Using Coffeescript And Screenshots
- Library Providing An NSNotificationCenter Alternative For Handling Multiple Delegates
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.