-
As I understand the problem it tries to get ![]() ![]() I wrote a simplified version of my code for a faster reproduce. Pay attention it's important to pass Starting point of the app: TripsChildView(
store: .init(initialState: .empty) {
TripsChild()
}
) Content is the following: struct TripsChild: Reducer {
@ObservableState
@CasePathable
@dynamicMemberLookup
enum State: Equatable {
case empty
case trips(IdentifiedArrayOf<TripChildListItem.State>)
}
@CasePathable
enum Action {
case onAppear
case trips(IdentifiedActionOf<TripChildListItem>)
}
var body: some Reducer<State, Action> {
Reduce { state, action in
return .none
}
.forEach(\.trips, action: \.trips) {
TripChildListItem()
}
}
}
struct TripsChildView: View {
let store: StoreOf<TripsChild>
var body: some View {
VStack {
switch store.state {
case .empty:
EmptyView()
case .trips:
List {
ForEach(store.scope(state: \.trips, action: \.trips)) { store in
TripChildItemView(store: store)
}
}
}
}
.onAppear {
store.send(.onAppear)
}
}
} and a list item: struct TripChildListItem: Reducer {
@ObservableState
struct State: Identifiable, Equatable {
let id = UUID()
}
@CasePathable
enum Action {}
var body: some Reducer<State, Action> {
EmptyReducer()
}
}
struct TripChildItemView: View {
let store: StoreOf<TripChildListItem>
var body: some View {
Text(store.state.id.uuidString)
}
} Xcode 15.4 p.s. I asked the similar question yesterday (#3245), but seems like it's another problem. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @Otbivnoe, this is the same problem as #3245. The getters you are using are unavailable, and it was a bug in Swift that this code was allowed. It has been fixed in Swift 6. |
Beta Was this translation helpful? Give feedback.
Answer in this thread: #3245