Skip to content

Commit e692799

Browse files
committed
No need to use a MutableProperty for the ViewStore state.
1 parent f08fabf commit e692799

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Sources/ComposableArchitecture/ViewStore.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,18 @@ public final class ViewStore<State, Action>: ObservableObject {
6262
self.state = store.state
6363
self._send = store.send
6464
producer.startWithValues { [weak self] in
65-
if #available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) {
66-
self?.objectWillChange.send()
67-
}
6865
self?.state = $0
6966
}
7067
}
7168

7269
/// The current state.
73-
@MutableProperty public internal(set) var state: State
70+
public private(set) var state: State {
71+
willSet {
72+
if #available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) {
73+
self.objectWillChange.send()
74+
}
75+
}
76+
}
7477

7578
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
7679
public lazy var objectWillChange: ObservableObjectPublisher = ObjectWillChangePublisher()

0 commit comments

Comments
 (0)