NetworkManager

The NetworkManager class manages network requests and processing of data. The NetworkManager class conforms to the NetworkManagerProtocol, which defines the set of methods and properties that are used to manage network requests and responses.

Use this signature to define the NetworkManager class.

Create a shared instance of the NetworkManager class by using this signature.

shared

Use Async/Await to get all the REST requests asynchronously by using this signature.

fetch(type:request:urlSession:)

Use the parameters in this table to create a fetch request.

ParametersDescription
typeA type or model of data that you want to decode from the JSON format.
requestThe URLRequest, which is executed by URLSession.
urlSessionAn instance of URLSession, which is used to execute the request and manage HTTP requests and responses. The default instance is URLSession.shared.