MNFJobDelegate

Objective-C

@protocol MNFJobDelegate <NSObject>

Swift

protocol MNFJobDelegate : NSObjectProtocol

A protocol for a job that can be used to access the jobs completion with a delegate.

  • @abstract A method for handling a job completion. @discussion Requests are performed using NSURLSession which normally uses a background thread to perform it’s requests. Therefore this method is performed on the current thread the request is performed on.

    Declaration

    Objective-C

    - (void)job:(nonnull MNFJob *)job
        didCompleteWithResult:(id _Nullable)result
                     metaData:(id _Nullable)metaData
                        error:(NSError *_Nullable)error;

    Swift

    optional func job(_ job: MNFJob, didCompleteWithResult result: Any?, metaData: Any?, error: Error?)

    Parameters

    result

    The result of the request.

    metaData

    The metaData of the request.

    error

    The error of the request.

  • @abstract A method for handling a job completion on the main thread. @discussion Requests are performed using NSURLSession which normally uses a background thread to perform it’s requests. This method forces the execution of completion to be performed on the main thread and is useful when handling ui action upon completion.

    Declaration

    Objective-C

    - (void)job:(nonnull MNFJob *)job
        didCompleteOnMainThreadWithResult:(id _Nullable)result
                                 metaData:(id _Nullable)metaData
                                    error:(NSError *_Nullable)error;

    Swift

    optional func job(_ job: MNFJob, didCompleteOnMainThreadWithResult result: Any?, metaData: Any?, error: Error?)

    Parameters

    result

    The result of the request.

    metaData

    The metaData of the request.

    error

    The error of the request.

  • @abstract A method for handling a job cancellation.

    Declaration

    Objective-C

    - (void)jobDidCancel:(nonnull MNFJob *)job;

    Swift

    optional func jobDidCancel(_ job: MNFJob)
  • @abstract A method for handling a job pausing.

    Declaration

    Objective-C

    - (void)jobDidPause:(nonnull MNFJob *)job;

    Swift

    optional func jobDidPause(_ job: MNFJob)
  • @abstract A method for handling a job resuming.

    Declaration

    Objective-C

    - (void)jobDidResume:(nonnull MNFJob *)job;

    Swift

    optional func jobDidResume(_ job: MNFJob)