NetworkManager
@objc public class NetworkManager: NSObject, INetworkManager
A NetworkManager object lets you send network requests. When it receives a
request to send it will be added to a queue and the queue is processed one
request at a time in a FIFO manner.
When an error is received in a response the request will be automatically
retried if the status code supports retries as determined by calling the
DarkMatterError.shouldRetry(code:) method.
-
The shared singleton instance.
Declaration
Swift
public static var instance: NetworkManager -
Initializes the network manager.
Declaration
Swift
public func initialize() -
Adds the request to the request queue. If there are no other requests in the queue it will be sent immediately, otherwise it will be sent once all requests before it in the queue are complete.
Parameters
requestThe request to send.
Return Value
A promise that will be resolved when the request is complete. The promise will be fulfilled with a
Responseobject on success or rejected with aDarkMatterErrorobject if an error occurred.
NetworkManager Class Reference