HUBActionContext

@protocol HUBActionContext <NSObject>

Protocol defining the public API of a contextual object used when executing an action

The Hub Framework automatically creates objects conforming to this protocol as part of handling an event which should cause an action to be performed. The context includes information that an action can use to make decisions on how to execute, and is always relative to the component for which the action will be performed.

  • The type of event that triggered the action to be performed

    Declaration

    Objective-C

    @property (readonly, assign, nonatomic) HUBActionTrigger trigger;
  • The identifier of any custom action that is being performed

    This property will be nil if this context is for the default selection action

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable)
        HUBIdentifier *customActionIdentifier;
  • Any custom data that was passed when triggering the action

    This property will always be nil if this context is for the default selection action

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable)
        NSDictionary<NSString *, id> *customData;
  • The URI of the view that the action is being performed in

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSURL *_Nonnull viewURI;
  • The view model of the view that the action is being performed in

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) id<HUBViewModel> _Nonnull viewModel;
  • The model of any component that the action is being performed for (nil if performed by a content operation)

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) id<HUBComponentModel>
        componentModel;
  • The view controller that the action is being performed in

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic)
        UIViewController *_Nonnull viewController;