TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Nikita Leonov.
Implementation of Service Locator design pattern for Objective C.
Register your service for protocol(s) implicitly or explicitly:
[NLServiceLocator registerService:myService];
[NLServiceLocator registerService:myService forProtocol:@protocol(NLSampleService)];
Retrieve services later when you need them by referencing protocol that it conforms and was used for implicit or explicit registration:
id<NLSampleService> myService = [NLServiceLocator serviceForProtocol:@protocol(NLSampleService)];
Done. Enjoy your nicely developed, loosely coupled architecture with an opportunity to replace service by its alternatives in a runtime. Just use it to make your code more managable, or simplify testing by providing mock services with couple of code lines.
pod "NLServiceLocator"
NLServiceLocator is available under the MIT license. See the LICENSE file for more info.