Skip to content

Instantly share code, notes, and snippets.

@egabor
Last active February 20, 2022 10:48
Show Gist options
  • Save egabor/e151d332ff9c17f23d97c0602e7a3300 to your computer and use it in GitHub Desktop.
Save egabor/e151d332ff9c17f23d97c0602e7a3300 to your computer and use it in GitHub Desktop.
Swift networking snippets (await/async)
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)
}
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