NetworkHelperDelegate
public protocol NetworkHelperDelegate : AnyObject
NetworkHelperDelegate is used when a futher action need to be performed while receiving the network response.
Version
1.5.0Date
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.
-
networkHelperShouldReceiveData(_:
Default implementationwithIdentifier: ) 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.
-
networkHelper(_:
Default implementationwithIdentifier: didDownloadToURL: ) 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.
-
networkHelper(_:
Default implementationwithIdentifier: didReceive: withStatusCode: ) 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)
-
networkHelper(_:
Default implementationwithIdentifier: didDownloadPercentage: ) 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.