HUBViewControllerDelegate

@protocol HUBViewControllerDelegate <NSObject>

Delegate protocol for HUBViewController

Conform to this protocol in a custom object to get notified of events occuring in a Hub Framework view controller

  • Sent to a Hub Framework view controller’s delegate when it is about to be updated with a new view model

    You can use this method to perform any custom UI operations on the whole view controller right before a new model will be rendered.

    Declaration

    Objective-C

    - (void)viewController:(nonnull HUBViewController *)viewController
        willUpdateWithViewModel:(nonnull id<HUBViewModel>)viewModel;

    Parameters

    viewController

    The view controller that will be updated

    viewModel

    The view model that the view controller will be updated with

  • Sent to a Hub Framework view controller’s delegate when it was updated with a new view model

    You can use this method to perform any custom UI operations on the whole view controller when a new view model has been rendered.

    Declaration

    Objective-C

    - (void)viewControllerDidUpdate:(nonnull HUBViewController *)viewController;

    Parameters

    viewController

    The view controller that was updated

  • Sent to a Hub Framework view controller’s delegate when it failed to be updated because of an error

    You can use this method to perform any custom UI operations to visualize that an error occured. Any previously loaded view model will still be used even if an error was encountered.

    Note that you can also use content operations (HUBContentOperation) to react to errors, and adjust the UI.

    Declaration

    Objective-C

    - (void)viewController:(nonnull HUBViewController *)viewController
        didFailToUpdateWithError:(nonnull NSError *)error;

    Parameters

    viewController

    The view controller that failed to update

    error

    The error that was encountered

  • Sent to a Hub Framework view controller’s delegate when the view finished rendering, due to a view model update.

    You can use this method to perform any custom UI operations on the whole view controller right after a new view model was rendered.

    Declaration

    Objective-C

    - (void)viewControllerDidFinishRendering:
        (nonnull HUBViewController *)viewController;

    Parameters

    viewController

    The view controller that finished rendering.

  • Sent to a Hub Framework view controller’s delegate to ask it whenever the view controller should start scrolling

    This method can be used to veto a scroll event from being started. It will be called every time the user starts scrolling the view that is rendering body components.

    Declaration

    Objective-C

    - (BOOL)viewControllerShouldStartScrolling:
        (nonnull HUBViewController *)viewController;

    Parameters

    viewController

    The view controller that is about to start scrolling

  • Sent to a Hub Framework view controller’s delegate when a component is about to appear on the screen

    Declaration

    Objective-C

    - (void)viewController:(nonnull HUBViewController *)viewController
        componentWithModel:(nonnull id<HUBComponentModel>)componentModel
              layoutTraits:(nonnull NSSet<HUBComponentLayoutTrait> *)layoutTraits
          willAppearInView:(nonnull UIView *)componentView;

    Parameters

    viewController

    The view controller in which a component is about to appear

    componentModel

    The model of the component that is about to appear

    layoutTraits

    The layout traits of the component that is about to appear

    componentView

    The view that the component is about to appear in

  • Sent to a Hub Framework view controller’s delegate when a component disappeared from the screen

    Declaration

    Objective-C

    - (void)viewController:(nonnull HUBViewController *)viewController
          componentWithModel:(nonnull id<HUBComponentModel>)componentModel
                layoutTraits:(nonnull NSSet<HUBComponentLayoutTrait> *)layoutTraits
        didDisappearFromView:(nonnull UIView *)componentView;

    Parameters

    viewController

    The view controller in which a component disappeared

    componentModel

    The model of the component that disappeared

    layoutTraits

    The layout traits of the component that disappeared

    componentView

    The view that the component disappeared from

  • Sent to a Hub Framework view controller’s delegate when a component view will be reused

    Declaration

    Objective-C

    - (void)viewController:(nonnull HUBViewController *)viewController
        willReuseComponentWithView:(nonnull UIView *)componentView;

    Parameters

    viewController

    The view controller in which a component view will be reused

    componentView

    The component view that will be reused

  • Sent to a Hub Framework view controller’s delegate when a component was selected

    Declaration

    Objective-C

    - (void)viewController:(nonnull HUBViewController *)viewController
        componentSelectedWithModel:(nonnull id<HUBComponentModel>)componentModel;

    Parameters

    viewController

    The view controller in which the component was selected

    componentModel

    The model of the component that was selected

  • Sent to a Hub Framework view controller’s delegate to ask if view controller should automatically manage content inset.

    @discussion When view controller automatically manages content inset it puts body components below header component and below navigation bar.

    Declaration

    Objective-C

    - (BOOL)viewControllerShouldAutomaticallyManageTopContentInset:
        (nonnull HUBViewController *)viewController;

    Parameters

    viewController

    The view controller which displays some components