Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
NetworkManager
Use this signature to define the NetworkManager class.
1public class NetworkManager : NetworkManagerProtocolCreate a Shared Instance
Create a shared instance of the NetworkManager class by using this signature.
shared
1public static let shared: NetworkManagerGet REST Requests
Use Async/Await to get all the REST requests asynchronously by using this signature.
fetch(type:request:urlSession:)
1public func fetch<T>(type: T.Type, request: URLRequest, urlSession: URLSession = URLSession.shared) async throws -> T where T : DecodableUse the parameters in this table to create a fetch request.
| Parameters | Description |
|---|---|
| type | A type or model of data that you want to decode from the JSON format. |
| request | The URLRequest, which is executed by URLSession. |
| urlSession | An instance of URLSession, which is used to execute the request and manage HTTP requests and responses. The default instance is URLSession.shared. |