ranoble / objective-c-dependency-injection Goto Github PK
View Code? Open in Web Editor NEWA small and simple DI library for objective C. Supports manual and Autowiring.
A small and simple DI library for objective C. Supports manual and Autowiring.
DepenencyContext is an attempt to bring lightweight simple Dependency Injection to Objective C. It currently only needs a dependencies file (plist), and the library including the SynthesizeSingleton.h class. The DependencyContext class is a singleton that keeps a list of used Services, but only loads the implementation at first request. At present only one instance per service will be instantiated. Support for other situations could be added later if it proves to be a requirement. Usage: Like standard DI you will need to define a protocol (interface for the java minded) and one or more implementations. Next you will need to define a dependencies file named dependencies.plist in your resources use the key column for your Service and the value as a String the implementation you wish to inject. Include DependencyContext.h in any files that you wish to use access the dependencies for. From here on in you can access any service using the [[DependencyContext sharedInstance] getDependency: __SERVICESTRING__] call. Autowiring - can be improved: Do as above; then create a property in the header file you plan to use. IE: id<Service> servicePropertyName; Next define the property further as @property(getter=[get[Service], readonly) id<Service> servicePropertyName; lastly in your implementation call the macro AUTO_WIRE([Service], @"[Service]") where service is the name of the service. now you can use the injected service as a standard (readonly) property
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.