Skip to content

Commit fe9ef7e

Browse files
[UPD] [Playgrounds] review comments
1 parent cee51c1 commit fe9ef7e

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

Playgrounds/SimpleStorage.playground/Contents.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let key = "\(user.id)"
2525
try storage.setObject(user, forKey: key)
2626

2727
// Fetch object from the cache
28-
storage.async.object(ofType:User.self, forKey: key) { result in
28+
storage.async.object(ofType: User.self, forKey: key) { result in
2929
switch result {
3030
case .value(let user):
3131
print(user.name)
@@ -38,7 +38,7 @@ storage.async.object(ofType:User.self, forKey: key) { result in
3838
try storage.removeObject(forKey: key)
3939

4040
// Try to fetch removed object from the cache
41-
storage.async.object(ofType:User.self, forKey: key) { result in
41+
storage.async.object(ofType: User.self, forKey: key) { result in
4242
switch result {
4343
case .value(let user):
4444
print(user.name)
@@ -51,4 +51,3 @@ storage.async.object(ofType:User.self, forKey: key) { result in
5151
try storage.removeAll()
5252

5353
PlaygroundPage.current.needsIndefiniteExecution = true
54-

Playgrounds/Storage.playground/Contents.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ struct Helper {
1717
return image!
1818
}
1919

20-
static func data(length : Int) -> Data {
21-
var buffer = [UInt8](repeating:0, count:length)
22-
return Data(bytes:&buffer, count: length)
20+
static func data(length: Int) -> Data {
21+
var buffer = [UInt8](repeating: 0, count: length)
22+
return Data(bytes: &buffer, count: length)
2323
}
2424
}
2525

@@ -49,26 +49,26 @@ try storage.setObject(date, forKey: "date")
4949
let cachedString = try? storage.object(ofType: String.self, forKey: "string")
5050
print(cachedString)
5151

52-
storage.async.object(ofType:ImageWrapper.self, forKey: "imageWrapper") { result in
52+
storage.async.object(ofType: ImageWrapper.self, forKey: "imageWrapper") { result in
5353
if case .value(let imageWrapper) = result {
5454
let image = imageWrapper.image
5555
print(image)
5656
}
5757
}
5858

59-
storage.async.object(ofType:Data.self, forKey: "data") { result in
59+
storage.async.object(ofType: Data.self, forKey: "data") { result in
6060
if case .value(let data) = result {
6161
print(data)
6262
}
6363
}
6464

65-
storage.async.object(ofType:Data.self, forKey: "data") { result in
65+
storage.async.object(ofType: Data.self, forKey: "data") { result in
6666
if case .value(let data) = result {
6767
print(data)
6868
}
6969
}
7070

71-
storage.async.object(ofType:Date.self, forKey: "date") { result in
71+
storage.async.object(ofType: Date.self, forKey: "date") { result in
7272
if case .value(let date) = result {
7373
print(date)
7474
}

0 commit comments

Comments
 (0)