HUBFeatureRegistry
@protocol HUBFeatureRegistry <NSObject>
Protocol defining the public API of a Hub feature registry
A feature is the top-level entity in the Hub Framework, that is used to ecapsulate related views into a logical group. Views that belong to the same feature share the same setup, such as a view URI predicate, content operation factories, etc.
-
-registerFeatureWithIdentifier:viewURIPredicate:title:contentOperationFactories:contentReloadPolicy:customJSONSchemaIdentifier:actionHandler:viewControllerScrollHandler:Register a feature with the Hub Framework
Registering a feature with the same identifier as one that is already registered is considered a severe error and will trigger an assert.
Declaration
Objective-C
- (void) registerFeatureWithIdentifier:(nonnull NSString *)featureIdentifier viewURIPredicate:(nonnull HUBViewURIPredicate *)viewURIPredicate title:(nonnull NSString *)title contentOperationFactories: (nonnull NSArray<id<HUBContentOperationFactory>> *) contentOperationFactories contentReloadPolicy: (nullable id<HUBContentReloadPolicy>)contentReloadPolicy customJSONSchemaIdentifier:(nullable NSString *)customJSONSchemaIdentifier actionHandler:(nullable id<HUBActionHandler>)actionHandler viewControllerScrollHandler: (nullable id<HUBViewControllerScrollHandler>)viewControllerScrollHandler;Parameters
featureIdentifierThe identifier of the feature. Used for logging & error messages. Must be unique across the app.
viewURIPredicateThe predicate that should be used to determine whether a given view URI is part of the feature. Use
HUBViewURIPredicateto define a predicate that matches what type of view URIs your feature should handle.titleThe title of the feature. This will be sent as part of the feature info to the content operations for views created for the feature. Should be fully localized and ready to be presented in the user interface.
contentOperationFactoriesThe factories that should be used to create content operations for the feature’s views. The order of the factories will determine the order in which the created content operations are called each time a view that is a part of the feature will load content. See
HUBContentOperationFactoryfor more information.contentReloadPolicyAny custom content reload policy that should be used for the feature. A content reload policy determines whenever a view belonging to the feature should have its content reloaded. If
nil, the default reload policy for this instance of the Hub Framework will be used. SeeHUBContentReloadPolicyfor more information.customJSONSchemaIdentifierAny identifier of a custom schema to use to parse JSON data. If
nil, the default schema will be used. Register your custom schema usingHUBJSONSchemaRegistry. SeeHUBJSONSchemafor more info.actionHandlerAny custom action handler that should be used for the feature. If
nil, any default action handler for this instance of the Hub Framework will be used. Action handlers can be used to run custom code instead of performing actions. SeeHUBActionHandlerfor more info.viewControllerScrollHandlerAny custom scroll handler to use to handle scroll events and customize scrolling behavior of view controllers created for this feature. See
HUBViewControllerScrollHandlerfor more info. -
Unregister a feature from the Hub Framework
After this method has been called, The Hub Framework will remove all information stored for the given identifier, and open it up to be registered again for another feature. If the given identifier does not exist, this method does nothing.
Declaration
Objective-C
- (void)unregisterFeatureWithIdentifier:(nonnull NSString *)featureIdentifier;Parameters
featureIdentifierThe identifier of the feature to unregister
View on GitHub
Install in Dash
HUBFeatureRegistry Protocol Reference