HUBViewControllerFactory
@protocol HUBViewControllerFactory <NSObject>
Protocol defining the public API of a factory that creates view controllers
You don’t conform to this protocol yourself. Instead, access this API through the application’s
HUBManager
. You use this API to create view controllers that are powered by the Hub Framework,
somewhere in your navigation code, where new view controllers should be pushed. Since the Hub
Framework uses URL-based navigation (per default), a recommended place to create view controllers
using this factory, would be when you are responding to opening URLs, for example in your App Delegate.
-
Return whether the factory is able to create a view controller for a given view URI
You can use this API to validate view URIs before starting to create a view controller for them.
Declaration
Objective-C
- (BOOL)canCreateViewControllerForViewURI:(nonnull NSURL *)viewURI;
Parameters
viewURI
The view URI to check if a view controller can be created for
-
Create a view controller for a certain pre-registered view URI
To be able to create a view controller without creating a feature, you can use the other view controller creation methods available on this protocol.
Declaration
Objective-C
- (nullable HUBViewController *)createViewControllerForViewURI: (nonnull NSURL *)viewURI;
Parameters
viewURI
The view URI to create a view controller for. The URI should match a feature that was previously registered with
HUBFeatureRegistry
.Return Value
A Hub Framework-powered view controller used for rendering content provided by a feature’s content operations, using a User Interface consisting of
HUBComponent
views. If a view controller could not be created for the supplied viewURI (because a feature registration could not be resolved for it), this method returnsnil
. -
Create a view controller without a feature registration, with implicit identifiers
The view controller’s feature identifier and view URI will be set by transforming the given feature title into lowercase characters.
Declaration
Objective-C
- (nonnull HUBViewController *) createViewControllerWithContentOperations: (nonnull NSArray<id<HUBContentOperation>> *)contentOperations featureTitle:(nonnull NSString *)featureTitle;
Parameters
contentOperations
The content operations to use to load the content for the view controller.
featureTitle
The title of the feature that the view controller will belong to. Used for its default title, and also made available to content operations as part of
HUBFeatureInfo
. -
Create a view controller without a feature registration, with explicit identifiers
Declaration
Objective-C
- (nonnull HUBViewController *) createViewControllerForViewURI:(nonnull NSURL *)viewURI contentOperations: (nonnull NSArray<id<HUBContentOperation>> *)contentOperations featureIdentifier:(nonnull NSString *)featureIdentifier featureTitle:(nonnull NSString *)featureTitle;
Parameters
viewURI
The URI of the view controller to create. This view URI will not be looked up in the Hub Framework’s feature registry, it will simply be assigned to the view controller.
contentOperations
The content operations to use to load the content for the view controller.
featureIdentifier
The identifier of the feature that the view controller will belong to. Will be made available to content operations as part of
HUBFeatureInfo
.featureTitle
The title of the feature that the view controller will belong to. Used for its default title, and also made available to contnet operations as part of
HUBFeatureInfo
.