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
identifierThe id of the task.
errorThe 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) -> BoolParameters
identifierThe 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
identifierThe id of the task.
dataThe 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
identifierThe id of the task.
urlThe 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
identifierThe id of the task.
percentageThe percentage received.
NetworkHelperDelegate Protocol Reference