HUBManager
@interface HUBManager : NSObject
This class is the main entry point into the Hub Framework
An application using the Hub Framework should create a single instance of this class and retain it in a central location (such as its App Delegate). This class exposes the public API of the Hub Framework in a modular fashion, with each part of the API encapsulated in either a registry or a factory.
-
The registry used to register features with the framework. See the documentation for
HUBFeatureRegistry
for more info.Declaration
Objective-C
@property (readonly, strong, nonatomic) id<HUBFeatureRegistry> _Nonnull featureRegistry;
-
The registry used to register components with the framework. See the documentation for
HUBComponentRegistry
for more info.Declaration
Objective-C
@property (readonly, strong, nonatomic) id<HUBComponentRegistry> _Nonnull componentRegistry;
-
The registry used to register actions with the framework. See the documentation for
HUBActionRegistry
for more info.Declaration
Objective-C
@property (readonly, strong, nonatomic) id<HUBActionRegistry> _Nonnull actionRegistry;
-
The registry used to register custom JSON schemas. See the documentation for
HUBJSONSchemaRegistry
for more info.Declaration
Objective-C
@property (readonly, strong, nonatomic) id<HUBJSONSchemaRegistry> _Nonnull JSONSchemaRegistry;
-
The factory used to create view model loaders. See
HUBViewModelLoaderFactory
for more info.Declaration
Objective-C
@property (readonly, strong, nonatomic) id<HUBViewModelLoaderFactory> _Nonnull viewModelLoaderFactory;
-
The factory used to create view controllers. See
HUBViewControllerFactory
for more info.Declaration
Objective-C
@property (readonly, strong, nonatomic) id<HUBViewControllerFactory> _Nonnull viewControllerFactory;
-
The manager used to create component showcases. See
HUBComponentShowcaseManager
for more info.Declaration
Objective-C
@property (readonly, strong, nonatomic) id<HUBComponentShowcaseManager> _Nonnull componentShowcaseManager;
-
The service that can be used to enable live editing of Hub Framework-powered view controllers. Always
nil
in release builds.Declaration
Objective-C
@property (readonly, strong, nonatomic, nullable) id<HUBLiveService> liveService;
-
-initWithComponentLayoutManager:componentFallbackHandler:connectivityStateResolver:imageLoaderFactory:iconImageResolver:defaultActionHandler:defaultContentReloadPolicy:prependedContentOperationFactory:appendedContentOperationFactory:
Initialize an instance of this class with all available customization options
In case you don’t want to use all of these customization options, see the initializers available in
HUBManager+Convenience.h
.Declaration
Objective-C
- (nonnull instancetype) initWithComponentLayoutManager: (nonnull id<HUBComponentLayoutManager>)componentLayoutManager componentFallbackHandler: (nonnull id<HUBComponentFallbackHandler>)componentFallbackHandler connectivityStateResolver: (nullable id<HUBConnectivityStateResolver>)connectivityStateResolver imageLoaderFactory: (nullable id<HUBImageLoaderFactory>)imageLoaderFactory iconImageResolver: (nullable id<HUBIconImageResolver>)iconImageResolver defaultActionHandler: (nullable id<HUBActionHandler>)defaultActionHandler defaultContentReloadPolicy: (nullable id<HUBContentReloadPolicy>)defaultContentReloadPolicy prependedContentOperationFactory: (nullable id<HUBContentOperationFactory>)prependedContentOperationFactory appendedContentOperationFactory: (nullable id<HUBContentOperationFactory>)appendedContentOperationFactory;
Parameters
componentLayoutManager
The object to use to manage layout for components, computing margins using layout traits. See
HUBComponentLayoutManager
for more information.componentFallbackHandler
The object to use to fall back to default components in case a component couldn’t be resolved using the standard mechanism. See
HUBComponentFallbackHandler
for more information.connectivityStateResolver
An object responsible for determining the current connectivity state of the application. If nil, a default implementation will be used, that uses the SystemConfiguration framework to determine connectivity.
imageLoaderFactory
Any custom factory that creates image loaders that are used to load remote images for components. If nil, a default image loader factory will be used. See
HUBImageLoaderFactory
for more info.iconImageResolver
Any object responsible for converting icons into renderable images. If nil, this instance of the Hub Framework won’t support icons. See
HUBIconImageResolver
for more information.defaultActionHandler
Any default action handler to use for features that do not define their own. An action handler enables execution of custom code instead of performing an action. See
HUBActionHandler
for more information.defaultContentReloadPolicy
Any default content reload policy to use for features that do not define their own. A content reload policy determines whenever a view belonging to the feature should have its content reloaded. If nil, any feature not defining its own reload policy will always be reloaded whenever a view that belongs to it re-appears. See
HUBContentReloadPolicy
for more information.prependedContentOperationFactory
Any content operation factory that should be prepended to the chain of content operation factories for all views. The operations that this factory produces will therefore always be prepended to the content loading chain of any view.
appendedContentOperationFactory
Any content operation factory that should be appended to the chain of content operation factories for all views. The operations that this factory produces will therefore always be appended to the content loading chain of any view.
-
Undocumented
Declaration
Objective-C
@interface HUBManager : NSObject
-
Undocumented
Declaration
Objective-C
@interface HUBManager : NSObject
-
Undocumented
Declaration
Objective-C
@interface HUBManager : NSObject
-
Create an instance of this class with a default configuration
This is the easiest way to setup the Hub Framework in an application. For more customization options, see this class’ designated initializer. The supplied
componentMargin
will be used to implement a defaultHUBComponentLayoutManager
, and thecomponentFallbackBlock
will be used for a defaultHUBComponentFallbackHandler
.Declaration
Objective-C
+ (nonnull instancetype) managerWithComponentMargin:(CGFloat)componentMargin componentFallbackBlock: (nonnull id<HUBComponent> _Nonnull (^)(HUBComponentCategory _Nonnull)) componentFallbackBlock;
Parameters
componentMargin
The margin to use in between components. Margin will be applied between two components except when both of them are not stackable (vertical) or when one of them is full width (horizontal). For more information, see the
Layout programming guide
.componentFallbackBlock
A block that should return a fallback component in case one couldn’t be resolved for a given component model. The block must always return a
HUBComponent
instance. -
Create an instance of this class with its required dependencies
This is a convenience initializer, to enable you to easily setup this class with the least amount of dependencies. For more customization options, see this class’ designated initializer.
Declaration
Objective-C
+ (nonnull instancetype) managerWithComponentLayoutManager: (nonnull id<HUBComponentLayoutManager>)componentLayoutManager componentFallbackHandler: (nonnull id<HUBComponentFallbackHandler>)componentFallbackHandler;
Parameters
componentLayoutManager
The object to use to manage layout for components, computing margins using layout traits. See
HUBComponentLayoutManager
for more information.componentFallbackHandler
The object to use to fall back to default components in case a component couldn’t be resolved using the standard mechanism. See
HUBComponentFallbackHandler
for more information.