Skip to content

Instantly share code, notes, and snippets.

@StewartLynch
Last active August 8, 2024 00:42
Show Gist options
  • Save StewartLynch/af10b49dbaafc69f3828e187bd346de5 to your computer and use it in GitHub Desktop.
Save StewartLynch/af10b49dbaafc69f3828e187bd346de5 to your computer and use it in GitHub Desktop.
App Crashes when return to Home Screen
import SwiftUI
struct ContentView: View {
@State private var selection: Int = 1
@AppStorage("MyAppTabViewCustomization") private var customization: TabViewCustomization
var body: some View {
TabView(selection: $selection) {
TabSection("Vacations") {
Tab("Planned", systemImage: "airplane", value: 1) {
Text("Planned Vacations")
}
.customizationID("plannedVacation")
Tab("Taken", systemImage: "checklist", value: 2) {
Text("Taken Vacations")
}
.customizationID("takenVacation")
}
.customizationID("VacationSection")
}
.tabViewStyle(.sidebarAdaptable)
.tabViewCustomization($customization)
}
}
#Preview {
ContentView()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment