Skip to content

Commit 6e44511

Browse files
committed
Adds documentation
1 parent 6c1f4a6 commit 6e44511

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Source/NetworkService+Async.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ import Foundation
1212
@available(iOS 13.0.0, *)
1313
public extension NetworkService {
1414

15+
/**
16+
Fetches a resource asynchronously from remote location. Execution of the requests starts immediately.
17+
18+
**Example**:
19+
```swift
20+
let networkService: NetworkService = //
21+
let resource: Resource<String> = //
22+
23+
let (result, response) = try await networkService.request(resource)
24+
```
25+
26+
- parameter resource: The resource you want to fetch.
27+
28+
- returns: a touple containing the parsed result and the HTTP response
29+
*/
1530
@discardableResult
1631
func request<Result>(_ resource: Resource<Result>) async throws -> (Result, HTTPURLResponse) {
1732
return try await withCheckedThrowingContinuation({ coninuation in

0 commit comments

Comments
 (0)