ForEachStore & TabView tag

Hello there!
I'm trying to implement ForEachStore within a TabView + PageStyle
Here is my childView's state (reduced state):

public struct State: Equatable, Identifiable {
  // MARK: Internal
  public let id: String
  public let index: Int
        
  public init( index: Int) {
    self.index = index
    self.id = index.description
  }
}

In my parent's view I'm doing this to implement a PagedStyle TabView.

@ViewBuilder
func contentView(
    singleBooking: CarEntrySteps.Infos.SingleBooking,
    store: CarEntrySteps.Store,
    viewStore: CarEntrySteps.ViewStore
) -> some View {
    TabView(selection: viewStore.presentedStepIndexBinding) {
        IfLetStore(
            store.carEntryInitialStep,
            then: CarEntryInitialStep.View.init(store:)
        )
        .tag(0)
        ForEachStore(store.carAccessSteps) { store in
            CarEntryStep.View(store: store)
                .tag(ViewStore(store).index)
        }
    }
    .tabViewStyle(
        PageTabViewStyle(indexDisplayMode: .never)
    )
    .overlay(
        PageIndicator(
          count: viewStore.entryStepsCount,
          selectedIndex: viewStore.presentedStepIndexBinding
        ),
        alignment: .bottom
    )
}

Everything is working as expected but my question is here:

CarEntryStep.View(store: store)
  .tag(ViewStore(store).index)

Is it okay, to init a temporary ViewStore just to get access to my index property on that child state ?

Thanks.

@Pwyll28 It's okay to access the state for index like you are. Sometimes I'd even create an additional view scoped to the index. You'd probably just want to make sure your parent view store CarEntrySteps.ViewStore isn't causing ForEachStore to recalculate unnecessarily.

Could you please show us how viewStore.presentedStepIndexBinding is defined? I was trying with @BindableState but compiler is complaining with error: Cannot convert value of type 'Int' to expected argument type 'Binding?'.