Inherits from NSObject
Declared in KVServiceContainer.h
KVServiceContainer.m

Overview

KVServiceContainer manages the storage and retrieval of services by acting as a central point of access in your app.

The methods for KVServiceContainer are in a separate protected header named KVServiceContainer-Protected.h. It is only intended for use by its subclasses.

Tasks

Public methods for accessing container

Other Methods

Class Methods

sharedInstance

Shared instance of the service container

+ (instancetype)sharedInstance

Return Value

Shared instance of the service container

Declared In

KVServiceContainer.h

Instance Methods

serviceForKey:

Retrieve a service with a particular key.

- (id)serviceForKey:(NSUInteger)serviceKey

Parameters

serviceKey

Key used to register the service

Return Value

The service registered for this key, or nil if no service has been registered

Discussion

Retrieve a service with a particular key.

Declared In

KVServiceContainer-Protected.h

serviceForKey:initializer:

Retrieves a service with a particular key.

- (id)serviceForKey:(NSUInteger)serviceKey initializer:(id ( ^ ) ( void ))initializer

Parameters

serviceKey

Key to use for registering the service

initializer

Block returning the service to register

Return Value

Service registered for this key

Discussion

Retrieves a service with a particular key.

If no service has been previously registered for this key, registers the result of initializer as the service for the key.

Declared In

KVServiceContainer-Protected.h

setService:forKey:

Register a service with a particular key.

- (void)setService:(id)service forKey:(NSUInteger)serviceKey

Parameters

service

Service to register

serviceKey

Key to use for registering the service

Discussion

Register a service with a particular key.

Declared In

KVServiceContainer-Protected.h