Latest 1.0.1
License MIT
Frameworks Foundation

Service Locator for Objective C


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.

Latest podspec

    "name": "NLServiceLocator",
    "version": "1.0.1",
    "summary": "Implementation of Service Locator design pattern for Objective C. ",
    "description": "                    Implementation of Service Locator design pattern that allows implicitly or explicitly register services with use of protocols and retrieve them later with use of the same protocols.n",
    "license": "MIT",
    "homepage": "",
    "authors": {
        "Nikita Leonov": "[email protected]"
    "social_media_url": "",
    "source": {
        "git": "",
        "tag": "1.0.1"
    "source_files": "ServiceLocator/*.{h,m}",
    "frameworks": "Foundation",
    "requires_arc": true

Pin It on Pinterest

Share This