Last active
February 20, 2022 10:48
-
-
Save egabor/e151d332ff9c17f23d97c0602e7a3300 to your computer and use it in GitHub Desktop.
Swift networking snippets (await/async)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func <#functionName#>(data: <#RequestType#>) async throws -> <#ReponseType#> { | |
let request = NetworkRequest(baseUrl, "<#endpointPath#>", .<#httpMethod#>, headers, body: convertToData(data: data)) | |
return try await buildRequest(with: request) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func <#functionName#>() async throws -> <#ResponseType#> { | |
let request = NetworkRequest(baseUrl, "<#endpointPath#>", .<#httpMethod#>, headers) | |
return try await buildRequest(with: request) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment