Skip to content

Commit d1799c5

Browse files
committed
Formatting/renaming
1 parent e973f83 commit d1799c5

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

AsyncMux/Sources/Multiplexer.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import Foundation
99

1010

11-
private let defaultTTL: TimeInterval = 30 * 60
12-
private let muxRootDomain = "_Root.Domain"
11+
private let DefaultTTL: TimeInterval = 30 * 60
12+
private let MuxRootDomain = "_Root.Domain"
1313

1414
@globalActor
1515
public actor MuxActor {
@@ -49,7 +49,7 @@ public final class Multiplexer<T: Codable & Sendable>: MuxRepositoryProtocol {
4949

5050
/// Performs a request either by calling the `onFetch` block supplied in the multiplexer's constructor, or by returning the previously cached object, if available. Multiple simultaneous calls to `request()` are handled by the Multiplexer so that only one `onFetch` operation can be invoked at a time, but all callers of `request()` will eventually receive the result.
5151
public func request() async throws -> T {
52-
return try await request(domain: muxRootDomain, key: cacheKey)
52+
return try await request(domain: MuxRootDomain, key: cacheKey)
5353
}
5454

5555
/// "Soft" refresh: the next call to `request()` will attempt to retrieve the object again, without discarding the caches in case of a failure. `refresh()` does not have an immediate effect on any ongoing asynchronous requests. Can be chained with the subsequent `request()`.
@@ -65,7 +65,7 @@ public final class Multiplexer<T: Codable & Sendable>: MuxRepositoryProtocol {
6565
public func save() {
6666
if isDirty, let storedValue {
6767
if let cacheKey {
68-
MuxCacher.save(storedValue, domain: muxRootDomain, key: cacheKey)
68+
MuxCacher.save(storedValue, domain: MuxRootDomain, key: cacheKey)
6969
}
7070
isDirty = false
7171
}
@@ -79,7 +79,7 @@ public final class Multiplexer<T: Codable & Sendable>: MuxRepositoryProtocol {
7979
/// Clears the memory and disk caches. Will trigger a full fetch on the next `request()` call.
8080
public func clear() {
8181
if let cacheKey {
82-
MuxCacher.delete(domain: muxRootDomain, key: cacheKey)
82+
MuxCacher.delete(domain: MuxRootDomain, key: cacheKey)
8383
}
8484
clearMemory()
8585
}
@@ -154,6 +154,6 @@ public final class Multiplexer<T: Codable & Sendable>: MuxRepositoryProtocol {
154154
}
155155

156156
internal var isExpired: Bool {
157-
Date().timeIntervalSinceReferenceDate > completionTime + defaultTTL
157+
Date().timeIntervalSinceReferenceDate > completionTime + DefaultTTL
158158
}
159159
}

AsyncMuxDemo/Sources/RemoteImage/LRUCache.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct LRUCache<K: Hashable, E>: Sequence {
8787
}
8888

8989

90-
__consuming func makeIterator() -> Iterator {
90+
consuming func makeIterator() -> Iterator {
9191
return Iterator(iteree: self)
9292
}
9393

AsyncMuxDemo/Sources/RemoteImage/RemoteImage.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ import AsyncMux
99

1010

1111
struct RemoteImage<P: View, I: View>: View {
12-
12+
1313
init(url: URL?, @ViewBuilder content: @escaping (Image) -> I, @ViewBuilder placeholder: @escaping (Error?) -> P) {
1414
self.model = url.map { Model(url: $0) }
1515
self.content = content
1616
self.placeholder = placeholder
1717
}
18-
18+
1919
private let model: Model?
2020
@ViewBuilder private let content: (Image) -> I
2121
@ViewBuilder private let placeholder: (Error?) -> P
22-
22+
2323
var body: some View {
2424
if let image = model?.image {
2525
content(image)
@@ -31,13 +31,13 @@ struct RemoteImage<P: View, I: View>: View {
3131
placeholder(nil)
3232
}
3333
}
34-
35-
34+
35+
3636
@MainActor
3737
@Observable final class Model {
3838
var image: Image?
3939
var error: Error?
40-
40+
4141
init(url: URL) {
4242
image = ImageCache.loadFromMemory(url)
4343
if image == nil {
@@ -57,7 +57,7 @@ struct RemoteImage<P: View, I: View>: View {
5757

5858
#Preview {
5959
let url = URL(string: "https://images.unsplash.com/photo-1513051265668-0ebab31671ae")!
60-
60+
6161
return RemoteImage(url: url) { image in
6262
image
6363
.resizable()

0 commit comments

Comments
 (0)