Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
vetrek authored Jul 26, 2023
1 parent 2d4436f commit 6a00d23
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,14 @@ Equivalent of https://api.example.com/person with the following body:

**API CALL**

- Using Closures
- Using async/await

```swift
network.request(with: endpoint) { (response) in
switch response.result {
case .success(let person):
print("Success! \(person.name)")
case .failure(let error):
print(error.localizedDescription)
}
do {
let response = try await network.request(with: endpoint)
print(response)
} catch {
print(error)
}
```

Expand All @@ -128,13 +126,15 @@ network.request(with: endpoint)?
.store(in: &subscriptions)
```

- Using async/await
- Using Closures

```swift
do {
let response = try await network.request(with: endpoint)
print(response)
} catch {
print(error)
network.request(with: endpoint) { (response) in
switch response.result {
case .success(let person):
print("Success! \(person.name)")
case .failure(let error):
print(error.localizedDescription)
}
}
```

0 comments on commit 6a00d23

Please sign in to comment.