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
here is the stack overflow question where I've posted a gif of the problem
StackOverflow Question (w/ Video) - https://stackoverflow.com/questions/62760985/swiftui-sidebar-doesnt-remember-state
This is the sidebar struct
import SwiftUI
struct Sidebar: View {
		
		@Environment(\.managedObjectContext) var moc
		@Binding var selection : Set<NavigationItem>
		
		var body: some View {
				List(selection: $selection) {
						NavigationLink(destination: AgendaView().environment(\.managedObjectContext, moc).navigationTitle("Agenda"), label: {
								Label("Agenda", systemImage: "book")
						})
						.tag(NavigationItem.agenda)
						
						NavigationLink(destination: Text("Subjects"), label: {
								Label("Materie", systemImage: "tray.full")
						})
						.tag(NavigationItem.subjects)
						
						NavigationLink(destination: Text("Calendario"), label: {
								Label("Calendario", systemImage: "calendar")
						})
						.tag(NavigationItem.calendar)
						
						NavigationLink(destination: SettingsView().environment(\.managedObjectContext, moc).navigationTitle("Impostazioni"), label: {
								Label("Impostazioni", systemImage: "gear")
						})
						.tag(NavigationItem.settings)
						
				}
				.listStyle(SidebarListStyle())
		}
}
for tagging the elements I use a custom struct called NavigationItem
enum NavigationItem {
		case agenda
		case calendar
		case ...
}
and here is where I placed the Sidebar in the content view, as you can see if the device is an iPad (detected using sizeClasses) I use the sidebar, otherwise if its an iPhone I use the TabBar
import SwiftUI
struct ContentView: View {
		@Environment(\.horizontalSizeClass) var horizontalSizeClass
		@Environment(\.managedObjectContext) var moc
		
		@State private var selection : Set<NavigationItem> = [.agenda]
		
		@ViewBuilder
		var body: some View {
				
				if horizontalSizeClass == .compact {
						TabBar(selection: $selection)
								.environment(\.managedObjectContext, moc)
				} else {
						NavigationView {
								Sidebar(selection: $selection)
										.environment(\.managedObjectContext, moc)
										.navigationTitle("Menu")
						}
				}
		}
}
Post
Replies
Boosts
Views
Activity
I have just published my first app, it's been online for more than 12 hours and still no ads are showing, I have successfully tested with both test ads and test devices and the ads unit ids are correct
My question is: how long does it take to have working ads on my app? also, do I need to do something else?
It’s been a day since I launched my first app and i saw that the app language is different in the appstore from the one i set on AppStoreConnect, i only have the italian language but for some reason in the store its listed as an english app