How to check for last item in a ForEachStore?

How to check if an item is the last item in userState? I need to hide a separator :man_facepalming:

List {
      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.

1 Like

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.

Terms of Service

Privacy Policy

Cookie Policy