Posts

Post not yet marked as solved
43 Replies
I had the same problem and my workaround was to replace the NavigationLink in the "trailing: " with a Button that triggered a State variable to show a .hidden NavigationLink.Example:struct ContentView: View { @EnvironmentObject var dataStore : DataStore @State private var showingInvite : Bool = (DataStore.shared().vehicles.count == 0) @State private var showVehicles : Bool = false var body: some View { NavigationView { VStack { MasterView() NavigationLink(destination: VehiclesView(currentCar: self.$dataStore.currentLog), isActive: self.$showingInvite) { Text("Add Vehicle") }.hidden() MenuView() } .navigationBarItems( trailing: Button(action: {self.showingInvite = true}, label: { if DataStore.shared().vehicles.count > 0 { Text(DataStore.shared().vehicles[self.dataStore.currentLog] ) } else { Text("Add") } }) ) } } }