I Have this app that uses the new sidebar introduced in iOS14 for iPad os but I can\'t figure out why it doesn\'t remember the state when its hidden
List(selection: $selection)
for selection binding is macOS only. See this comment in the header:
/// On iOS and tvOS, you must explicitly put the list into edit mode for
/// the selection to apply.
As a workaround you could make the previously selected row appear bold, e.g.
NavigationLink(
destination: HomeView(),
tag: Screen.home,
selection: $selection,
label: {
Label("Home", systemImage: "house" )
})
.font(Font.headline.weight(selection == Screen.home ? .bold : .regular))
For more see this answer.