Skip to content

Commit 8624a8e

Browse files
mbrandonwgithub-actions[bot]
authored andcommitted
Run swift-format
1 parent e121b91 commit 8624a8e

File tree

11 files changed

+73
-72
lines changed

11 files changed

+73
-72
lines changed

Examples/CaseStudies/SwiftUICaseStudies/02-SharedState-Onboarding.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,8 @@ private struct SummaryStep: View {
496496
}
497497
}
498498

499-
fileprivate extension Set {
500-
subscript(contains element: Element) -> Bool {
499+
extension Set {
500+
fileprivate subscript(contains element: Element) -> Bool {
501501
get { contains(element) }
502502
set {
503503
if newValue {

Examples/SyncUps/SyncUps/AppFeature.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct AppView: View {
7373
@Shared(.syncUps) var syncUps = [
7474
.mock,
7575
.productMock,
76-
.engineeringMock
76+
.engineeringMock,
7777
]
7878
return AppView(
7979
store: Store(initialState: AppFeature.State()) {

Examples/SyncUps/SyncUps/SyncUpsList.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ extension LabelStyle where Self == TrailingIconLabelStyle {
158158
@Shared(.syncUps) var syncUps = [
159159
.mock,
160160
.productMock,
161-
.engineeringMock
161+
.engineeringMock,
162162
]
163163
return NavigationStack {
164164
SyncUpsListView(

Examples/SyncUps/SyncUpsTests/RecordMeetingTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class RecordMeetingTests: XCTestCase {
2727
RecordMeeting()
2828
} withDependencies: {
2929
$0.continuousClock = clock
30-
$0.date.now = Date(timeIntervalSince1970: 1234567890)
30+
$0.date.now = Date(timeIntervalSince1970: 1_234_567_890)
3131
$0.dismiss = DismissEffect {
3232
dismissed.fulfill()
3333
}
@@ -79,7 +79,7 @@ final class RecordMeetingTests: XCTestCase {
7979
$0.syncUp.meetings.insert(
8080
Meeting(
8181
id: Meeting.ID(UUID(0)),
82-
date: Date(timeIntervalSince1970: 1234567890),
82+
date: Date(timeIntervalSince1970: 1_234_567_890),
8383
transcript: ""
8484
),
8585
at: 0
@@ -117,7 +117,7 @@ final class RecordMeetingTests: XCTestCase {
117117
RecordMeeting()
118118
} withDependencies: {
119119
$0.continuousClock = clock
120-
$0.date.now = Date(timeIntervalSince1970: 1234567890)
120+
$0.date.now = Date(timeIntervalSince1970: 1_234_567_890)
121121
$0.dismiss = DismissEffect { dismissed.fulfill() }
122122
$0.speechClient.authorizationStatus = { .authorized }
123123
$0.speechClient.startTask = { @Sendable _ in
@@ -168,7 +168,7 @@ final class RecordMeetingTests: XCTestCase {
168168
RecordMeeting()
169169
} withDependencies: {
170170
$0.continuousClock = clock
171-
$0.date.now = Date(timeIntervalSince1970: 1234567890)
171+
$0.date.now = Date(timeIntervalSince1970: 1_234_567_890)
172172
$0.dismiss = DismissEffect { dismissed.fulfill() }
173173
$0.speechClient.authorizationStatus = { .denied }
174174
$0.uuid = .incrementing
@@ -190,7 +190,7 @@ final class RecordMeetingTests: XCTestCase {
190190
$0.syncUp.meetings.insert(
191191
Meeting(
192192
id: Meeting.ID(UUID(0)),
193-
date: Date(timeIntervalSince1970: 1234567890),
193+
date: Date(timeIntervalSince1970: 1_234_567_890),
194194
transcript: ""
195195
),
196196
at: 0
@@ -257,7 +257,7 @@ final class RecordMeetingTests: XCTestCase {
257257
RecordMeeting()
258258
} withDependencies: {
259259
$0.continuousClock = clock
260-
$0.date.now = Date(timeIntervalSince1970: 1234567890)
260+
$0.date.now = Date(timeIntervalSince1970: 1_234_567_890)
261261
$0.dismiss = DismissEffect { dismissed.fulfill() }
262262
$0.speechClient.authorizationStatus = { .denied }
263263
$0.uuid = .incrementing
@@ -284,7 +284,7 @@ final class RecordMeetingTests: XCTestCase {
284284
$0.syncUp.meetings.insert(
285285
Meeting(
286286
id: Meeting.ID(UUID(0)),
287-
date: Date(timeIntervalSince1970: 1234567890),
287+
date: Date(timeIntervalSince1970: 1_234_567_890),
288288
transcript: ""
289289
),
290290
at: 0
@@ -321,7 +321,7 @@ final class RecordMeetingTests: XCTestCase {
321321
RecordMeeting()
322322
} withDependencies: {
323323
$0.continuousClock = clock
324-
$0.date.now = Date(timeIntervalSince1970: 1234567890)
324+
$0.date.now = Date(timeIntervalSince1970: 1_234_567_890)
325325
$0.dismiss = DismissEffect { dismissed.fulfill() }
326326
$0.speechClient.authorizationStatus = { .authorized }
327327
$0.speechClient.startTask = { @Sendable _ in

Sources/ComposableArchitecture/Reducer/Reducers/DebugReducer.swift

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -81,42 +81,42 @@ public struct _PrintChangesReducer<Base: Reducer>: Reducer {
8181
self.printer = printer
8282
}
8383

84-
#if DEBUG
85-
public func reduce(
86-
into state: inout Base.State, action: Base.Action
87-
) -> Effect<Base.Action> {
88-
if let printer = self.printer {
89-
return withSharedChangeTracking { changeTracker in
90-
let oldState = state
91-
let effects = self.base.reduce(into: &state, action: action)
92-
return withEscapedDependencies { continuation in
93-
effects.merge(
94-
with: .publisher { [newState = state, queue = printer.queue] in
95-
Deferred<Empty<Action, Never>> {
96-
queue.async {
97-
continuation.yield {
98-
changeTracker.assert {
99-
printer.printChange(
100-
receivedAction: action, oldState: oldState, newState: newState
101-
)
84+
#if DEBUG
85+
public func reduce(
86+
into state: inout Base.State, action: Base.Action
87+
) -> Effect<Base.Action> {
88+
if let printer = self.printer {
89+
return withSharedChangeTracking { changeTracker in
90+
let oldState = state
91+
let effects = self.base.reduce(into: &state, action: action)
92+
return withEscapedDependencies { continuation in
93+
effects.merge(
94+
with: .publisher { [newState = state, queue = printer.queue] in
95+
Deferred<Empty<Action, Never>> {
96+
queue.async {
97+
continuation.yield {
98+
changeTracker.assert {
99+
printer.printChange(
100+
receivedAction: action, oldState: oldState, newState: newState
101+
)
102+
}
102103
}
103104
}
105+
return Empty()
104106
}
105-
return Empty()
106107
}
107-
}
108-
)
108+
)
109+
}
109110
}
110111
}
112+
return self.base.reduce(into: &state, action: action)
111113
}
112-
return self.base.reduce(into: &state, action: action)
113-
}
114114
#else
115-
@inlinable
116-
public func reduce(
117-
into state: inout Base.State, action: Base.Action
118-
) -> Effect<Base.Action> {
119-
return self.base.reduce(into: &state, action: action)
120-
}
115+
@inlinable
116+
public func reduce(
117+
into state: inout Base.State, action: Base.Action
118+
) -> Effect<Base.Action> {
119+
return self.base.reduce(into: &state, action: action)
120+
}
121121
#endif
122122
}

Sources/ComposableArchitecture/SharedState/PersistenceKey/AppStorageKey.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ where Value.RawValue == Base.Value {
391391
) -> Value? {
392392
base.loadValue(from: store, at: key, default: defaultValue?.rawValue)
393393
.flatMap(Value.init(rawValue:))
394-
?? defaultValue
394+
?? defaultValue
395395
}
396396
func saveValue(_ newValue: Value, to store: UserDefaults, at key: String) {
397397
base.saveValue(newValue.rawValue, to: store, at: key)

Sources/ComposableArchitecture/SharedState/References/ValueReference.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension Shared {
4545
) where Value == Wrapped? {
4646
self.init(wrappedValue: nil, persistenceKey, fileID: fileID, line: line)
4747
}
48-
48+
4949
@_disfavoredOverload
5050
public init(
5151
_ persistenceKey: some PersistenceKey<Value>,
@@ -137,7 +137,7 @@ extension SharedReader {
137137
}
138138
self.init(wrappedValue: initialValue, persistenceKey, fileID: fileID, line: line)
139139
}
140-
140+
141141
public init<Key: PersistenceReaderKey>(
142142
_ persistenceKey: PersistenceKeyDefault<Key>,
143143
fileID: StaticString = #fileID,

Sources/ComposableArchitecture/SharedState/Shared.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public struct Shared<Value> {
125125
return Shared<Member>(
126126
reference: self.reference,
127127
keyPath: self.keyPath.appending(
128-
path: keyPath.appending(path: \.[default: DefaultSubscript(initialValue)])
128+
path: keyPath.appending(path: \.[default:DefaultSubscript(initialValue)])
129129
)!
130130
)
131131
}
@@ -366,7 +366,7 @@ extension Shared {
366366
return SharedReader<Member>(
367367
reference: self.reference,
368368
keyPath: self.keyPath.appending(
369-
path: keyPath.appending(path: \.[default: DefaultSubscript(initialValue)])
369+
path: keyPath.appending(path: \.[default:DefaultSubscript(initialValue)])
370370
)!
371371
)
372372
}

Sources/ComposableArchitecture/SharedState/SharedReader.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#if canImport(Combine)
2-
import Combine
2+
import Combine
33
#endif
44

55
/// A property wrapper type that shares a value with multiple parts of an application.
@@ -74,17 +74,17 @@ public struct SharedReader<Value> {
7474
)
7575
}
7676

77-
#if canImport(Combine)
78-
// TODO: Should this be wrapped in a type we own instead of `AnyPublisher`?
79-
public var publisher: AnyPublisher<Value, Never> {
80-
func open<R: Reference>(_ reference: R) -> AnyPublisher<Value, Never> {
81-
return reference.publisher
82-
.compactMap { $0[keyPath: self.keyPath] as? Value }
83-
.eraseToAnyPublisher()
77+
#if canImport(Combine)
78+
// TODO: Should this be wrapped in a type we own instead of `AnyPublisher`?
79+
public var publisher: AnyPublisher<Value, Never> {
80+
func open<R: Reference>(_ reference: R) -> AnyPublisher<Value, Never> {
81+
return reference.publisher
82+
.compactMap { $0[keyPath: self.keyPath] as? Value }
83+
.eraseToAnyPublisher()
84+
}
85+
return open(self.reference)
8486
}
85-
return open(self.reference)
86-
}
87-
#endif
87+
#endif
8888
}
8989

9090
extension SharedReader: @unchecked Sendable where Value: Sendable {}

Sources/ComposableArchitecture/TestStore.swift

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,13 +1080,13 @@ extension TestStore where State: Equatable {
10801080
let difference = self.withExhaustivity(.on) {
10811081
diff(expected, actual, format: .proportional)
10821082
.map { "\($0.indent(by: 4))\n\n(Expected: −, Actual: +)" }
1083-
?? """
1084-
Expected:
1085-
\(String(describing: expected).indent(by: 2))
1083+
?? """
1084+
Expected:
1085+
\(String(describing: expected).indent(by: 2))
10861086
1087-
Actual:
1088-
\(String(describing: actual).indent(by: 2))
1089-
"""
1087+
Actual:
1088+
\(String(describing: actual).indent(by: 2))
1089+
"""
10901090
}
10911091
let messageHeading =
10921092
!preamble.isEmpty
@@ -1148,13 +1148,13 @@ extension TestStore where State: Equatable, Action: Equatable {
11481148
TaskResultDebugging.$emitRuntimeWarnings.withValue(false) {
11491149
diff(expectedAction, receivedAction, format: .proportional)
11501150
.map { "\($0.indent(by: 4))\n\n(Expected: −, Received: +)" }
1151-
?? """
1152-
Expected:
1153-
\(String(describing: expectedAction).indent(by: 2))
1151+
?? """
1152+
Expected:
1153+
\(String(describing: expectedAction).indent(by: 2))
11541154
1155-
Received:
1156-
\(String(describing: receivedAction).indent(by: 2))
1157-
"""
1155+
Received:
1156+
\(String(describing: receivedAction).indent(by: 2))
1157+
"""
11581158
}
11591159
},
11601160
updateStateToExpectedResult,
@@ -2568,7 +2568,8 @@ extension TestStore {
25682568
@available(
25692569
*,
25702570
unavailable,
2571-
message: "Provide a key path to the case you expect to receive (like 'store.receive(\\.tap)'), or conform 'Action' to 'Equatable' to assert against it directly."
2571+
message:
2572+
"Provide a key path to the case you expect to receive (like 'store.receive(\\.tap)'), or conform 'Action' to 'Equatable' to assert against it directly."
25722573
)
25732574
public func receive(
25742575
_ expectedAction: Action,

0 commit comments

Comments
 (0)