KVServiceContainer Class Reference
| 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
-
+ sharedInstanceShared instance of the service container
Other Methods
-
– serviceForKey:Retrieve a service with a particular key.
-
– serviceForKey:initializer:Retrieves a service with a particular key.
-
– setService:forKey:Register a service with a particular key.
Instance Methods
serviceForKey:
Retrieve a service with a particular key.
- (id)serviceForKey:(NSUInteger)serviceKeyParameters
- 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.hserviceForKey:initializer:
Retrieves a service with a particular key.
- (id)serviceForKey:(NSUInteger)serviceKey initializer:(id ( ^ ) ( void ))initializerParameters
- 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.hsetService:forKey:
Register a service with a particular key.
- (void)setService:(id)service forKey:(NSUInteger)serviceKeyParameters
- 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