Skip to content

Commit a5d5af3

Browse files
authored
Merge pull request #183 from guoyingtao/ImproveReadme
Improved sample code of storage's async functions in README
2 parents b6e7b35 + cbc6e3d commit a5d5af3

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ storage.async.setObject("Oslo", forKey: "my favorite city") { result in
212212
print("saved successfully")
213213
case .error(let error):
214214
print(error)
215-
}
216215
}
217216
}
218217

@@ -222,7 +221,6 @@ storage.async.object(ofType: String.self, forKey: "my favorite city") { result i
222221
print("my favorite city is \(city)")
223222
case .error(let error):
224223
print(error)
225-
}
226224
}
227225
}
228226

@@ -233,11 +231,21 @@ storage.async.existsObject(ofType: String.self, forKey: "my favorite city") { re
233231
}
234232

235233
storage.async.removeAll() { result in
236-
print("removal completes")
234+
switch result {
235+
case .value:
236+
print("removal completes")
237+
case .error(let error):
238+
print(error)
239+
}
237240
}
238241

239242
storage.async.removeExpiredObjects() { result in
240-
print("removal completes")
243+
switch result {
244+
case .value:
245+
print("removal completes")
246+
case .error(let error):
247+
print(error)
248+
}
241249
}
242250
```
243251

0 commit comments

Comments
 (0)