HUBContentOperationDelegate
@protocol HUBContentOperationDelegate <NSObject>
Delegate protocol for objects conforming to HUBContentOperation
You don’t conform to this protocol yourself. Instead, you synthesize your content operation’s delegate
property, which the Hub Framework will assign. You may then use the methods defined in this protocol to
communicate content operation events back to the framework.
-
Notify the Hub Framework that a content operation finished
All operations are required to either call this method, or the one that signals a failure, to notify the framework of its outcome. Note that this method can only be called once per execution - multiple calls will be ignored. To be able to update the operation’s state - first call
-contentOperationRequiresRescheduling:
to get the Hub Framework to reschedule and re-execute the operation.It’s safe to call this method from any thread, as the framework will automatically dispatch to the main queue in case it’s called from a background thread.
Declaration
Objective-C
- (void)contentOperationDidFinish:(nonnull id<HUBContentOperation>)operation;
Parameters
operation
The operation that finished
-
Notify the Hub Framework that a content operation failed because of an error
Use this method to propagate an error from a content operation to the framework. If this method is called, an attempt will be made to recover by sending the error when calling any next content operation in the sequence as
previousContentOperationError
. If the next content operation manages to recover, the error is silenced. If no additional content operations were able to recover, the error will block the creation of a view model and a visual representation of it will be rendered instead of content.It’s safe to call this method from any thread, as the framework will automatically dispatch to the main queue in case it’s called from a background thread.
Declaration
Objective-C
- (void)contentOperation:(nonnull id<HUBContentOperation>)operation didFailWithError:(nonnull NSError *)error;
Parameters
operation
The operation that encountered an error
error
The error that was encountered
-
Notify the Hub Framework that a content operation requires rescheduling
Use this method to get an operation to be re-executed by the framework, to be able to react to changes in any underlying data model or after a certain period of time has passed. When this is called, the framework will put the operation - as well as any subsequent operations after it in the content loading chain - in its content loading queue, and will execute it as soon as possible.
It’s safe to call this method from any thread, as the framework will automatically dispatch to the main queue in case it’s called from a background thread.
Declaration
Objective-C
- (void)contentOperationRequiresRescheduling: (nonnull id<HUBContentOperation>)operation;
Parameters
operation
The operation that requires rescheduling