KRHub
Objective-C
@interface KRHub : NSObject
                Swift
class KRHub : NSObject
                A KRHub object can easily become a container of references to other objects or classes, organized in groups. To be able to register themselves with a KRHub, objects must implement the KRAdapter protocol. Within a single group there can not be more objects that declare the same type.
- 
                  
                  
Returns the list of available registered objects for a specified group.
Declaration
Objective-C
- (NSMutableDictionary *_Nullable)adaptersForGroup:(NSString *_Nonnull)group;Swift
func adapters(forGroup group: String) -> NSMutableDictionary?Parameters
groupThe required group.
Return Value
A dictionary containing all objects registered for the required group. The dictionary keys are the types, as specified by the objects.
 - 
                  
                  
Returns an object of the specified type, if such an object is currently registered in the default group.
Declaration
Objective-C
- (NSObject<KRAdapter> *_Nullable)adapterForType:(NSString *_Nonnull)type;Swift
func adapter(forType type: String) -> KRAdapter?Parameters
typeThe required object type.
Return Value
An object if any is registered,
nilotherwise. - 
                  
                  
Registeres a new adapter to a specific group
Declaration
Objective-C
- (void)registerAdapter:(NSObject<KRAdapter> *_Nonnull)adapter inGroup:(NSString *_Nullable)group;Swift
func register(_ adapter: KRAdapter, inGroup group: String?)Parameters
adapterThe adapter to be registered. The object needs to implement
KRAdapter.groupThe group to register the adapter into.
 - 
                  
                  
Returns an object of the specified type, if such an object is currently registered in the specified group.
Declaration
Objective-C
- (NSObject<KRAdapter> *_Nullable)adapterForType:(NSString *_Nonnull)type inGroup:(NSString *_Nullable)group;Swift
func adapter(forType type: String, inGroup group: String?) -> KRAdapter?Parameters
typeThe required object type.
groupThe required group.
Return Value
An object if any is registered,
nilotherwise. - 
                  
                  
Registers a class to a specific group and a specific type. Upon requesting a new object from this group and type, a new object of the registered class will be instantiated and returned.
Declaration
Objective-C
- (void)registerClass:(Class _Nonnull)cclass inGroup:(NSString *_Nullable)group;Swift
func register(_ cclass: AnyClass, inGroup group: String?)Parameters
cclassThe class to register.
groupThe group to register the call into.
 - 
                  
                  
Registers a class to the default group, under a specific type. Upon requesting a new object from this type from the default group, a new object of the registered class will be instantiated and returned.
Declaration
Objective-C
- (void)registerClass:(Class _Nonnull)cclass;Swift
func register(_ cclass: AnyClass)Parameters
cclassThe class to register
 
      KRHub Class Reference