How to check if an item is the last item in userState
? I need to hide a separator
List {
ForEachStore(
store.scope(
state: \.userState,
action: TeamAction.user(index:action:)
), content: UserView.init(store:)
)
}
How to check if an item is the last item in userState
? I need to hide a separator
List {
ForEachStore(
store.scope(
state: \.userState,
action: TeamAction.user(index:action:)
), content: UserView.init(store:)
)
}
The easiest one I can think of is var isLast: Bool
property inside the state.
I thought maybe there's a way to access the array that the ForEachStore
is iterating over, and check the index of current item. Maybe it's possible to write an extension? It shouldn't add much performance overhead honestly.