Skip to content

Commit c66a234

Browse files
committed
Fix Linux build and test
1 parent e854218 commit c66a234

File tree

3 files changed

+35
-33
lines changed

3 files changed

+35
-33
lines changed

ComposableArchitecture.xcworkspace/xcshareddata/xcschemes/ComposableArchitecture.xcscheme

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
</BuildActionEntries>
2424
</BuildAction>
2525
<TestAction
26-
buildConfiguration = "Release"
27-
selectedDebuggerIdentifier = ""
28-
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES"
3030
codeCoverageEnabled = "YES">
3131
<Testables>

Sources/ComposableArchitecture/ViewStore.swift

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,35 @@ public struct ViewStoreTask: Hashable, Sendable {
728728
#if canImport(Combine)
729729
extension ViewStore: ObservableObject {
730730
}
731+
732+
final private class ValueWrapper<V>: ObservableObject {
733+
var value: V {
734+
willSet { objectWillChange.send() }
735+
}
736+
737+
init(_ value: V) {
738+
self.value = value
739+
}
740+
}
741+
742+
@propertyWrapper private struct ObservedState<Value>: DynamicProperty {
743+
@ObservedObject private var box: ValueWrapper<Value>
744+
745+
var wrappedValue: Value {
746+
get { box.value }
747+
nonmutating set { box.value = newValue }
748+
}
749+
750+
var projectedValue: Binding<Value> {
751+
.init(
752+
get: { wrappedValue },
753+
set: { wrappedValue = $0 }
754+
)
755+
}
756+
init(wrappedValue value: Value) {
757+
self._box = ObservedObject(wrappedValue: .init(value))
758+
}
759+
}
731760
#endif
732761

733762
/// A producer of store state.
@@ -767,32 +796,3 @@ public struct StoreProducer<State>: SignalProducerConvertible {
767796
self.upstream.map(keyPath).skipRepeats()
768797
}
769798
}
770-
771-
final private class ValueWrapper<V>: ObservableObject {
772-
var value: V {
773-
willSet { objectWillChange.send() }
774-
}
775-
776-
init(_ value: V) {
777-
self.value = value
778-
}
779-
}
780-
781-
@propertyWrapper private struct ObservedState<Value>: DynamicProperty {
782-
@ObservedObject private var box: ValueWrapper<Value>
783-
784-
var wrappedValue: Value {
785-
get { box.value }
786-
nonmutating set { box.value = newValue }
787-
}
788-
789-
var projectedValue: Binding<Value> {
790-
.init(
791-
get: { wrappedValue },
792-
set: { wrappedValue = $0 }
793-
)
794-
}
795-
init(wrappedValue value: Value) {
796-
self._box = ObservedObject(wrappedValue: .init(value))
797-
}
798-
}

Tests/ComposableArchitectureTests/RuntimeWarningTests.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,12 @@
206206
reducer: EmptyReducer<State, Action>()
207207
)
208208

209+
let viewStore = ViewStore(store)
210+
209211
var line: UInt = 0
210212
XCTExpectFailure {
211213
line = #line
212-
ViewStore(store).binding(\.$value).wrappedValue = 42
214+
viewStore.binding(\.$value).wrappedValue = 42
213215
} issueMatcher: {
214216
$0.compactDescription == """
215217
A binding action sent from a view store at "\(#fileID):\(line + 1)" was not handled. …

0 commit comments

Comments
 (0)