Skip to content

Commit cbe013b

Browse files
authored
Remove @StateObject shim for now (#1358)
* Remove `@StateObject` shim for now * remove
1 parent 1bd62e4 commit cbe013b

File tree

2 files changed

+3
-44
lines changed

2 files changed

+3
-44
lines changed

Sources/ComposableArchitecture/Internal/_StateObject.swift

Lines changed: 0 additions & 41 deletions
This file was deleted.

Sources/ComposableArchitecture/SwiftUI/WithViewStore.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ public struct WithViewStore<ViewState, ViewAction, Content> {
117117
private var prefix: String?
118118
private var previousState: (ViewState) -> ViewState?
119119
#endif
120-
@_StateObject private var viewStore: ViewStore<ViewState, ViewAction>
120+
@ObservedObject private var viewStore: ViewStore<ViewState, ViewAction>
121121

122122
init(
123-
store: @autoclosure @escaping () -> Store<ViewState, ViewAction>,
123+
store: Store<ViewState, ViewAction>,
124124
removeDuplicates isDuplicate: @escaping (ViewState, ViewState) -> Bool,
125125
content: @escaping (ViewStore<ViewState, ViewAction>) -> Content,
126126
file: StaticString = #fileID,
@@ -136,7 +136,7 @@ public struct WithViewStore<ViewState, ViewAction, Content> {
136136
return previousState
137137
}
138138
#endif
139-
self._viewStore = .init(wrappedValue: ViewStore(store(), removeDuplicates: isDuplicate))
139+
self.viewStore = ViewStore(store, removeDuplicates: isDuplicate)
140140
}
141141

142142
/// Prints debug information to the console whenever the view is computed.

0 commit comments

Comments
 (0)