NetworkHelperDelegate

public protocol NetworkHelperDelegate : AnyObject

NetworkHelperDelegate is used when a futher action need to be performed while receiving the network response.

Author

Adamas

Version

1.5.0

Date

02/04/2019
  • Error catched during the operation.

    Declaration

    Swift

    func networkHelper(_ networkHelper: NetworkHelper,
                       withIdentifier identifier: String,
                       didCatchError error: String)

    Parameters

    identifier

    The id of the task.

    error

    The error message.

  • Whether the task should continue receiving the data after the response or not.

    Default Implementation

    Declaration

    Swift

    func networkHelperShouldReceiveData(_ networkHelper: NetworkHelper,
                                        withIdentifier identifier: String) -> Bool

    Parameters

    identifier

    The id of the task.

    Return Value

    Whether the task should continue receiving data or not.

  • Receive the data from the server.

    Declaration

    Swift

    func networkHelper(_ networkHelper: NetworkHelper,
                       withIdentifier identifier: String,
                       didReceive data: Data)

    Parameters

    identifier

    The id of the task.

    data

    The data retrieved.

  • Did download the data from the server.

    Default Implementation

    Declaration

    Swift

    func networkHelper(_ networkHelper: NetworkHelper,
                       withIdentifier identifier: String,
                       didDownloadToURL url: String)

    Parameters

    identifier

    The id of the task.

    url

    The temp url.

  • Receive a response from the server including all the attributes

    Default Implementation

    Declaration

    Swift

    func networkHelper(_ networkHelper: NetworkHelper,
                       withIdentifier identifier: String,
                       didReceive header: NetworkResponseHeader,
                       withStatusCode statusCode: Int)
  • Receive how many percentage of the file.

    Default Implementation

    Declaration

    Swift

    func networkHelper(_ networkHelper: NetworkHelper,
                       withIdentifier identifier: String,
                       didDownloadPercentage percentage: Double)

    Parameters

    identifier

    The id of the task.

    percentage

    The percentage received.