I am trying to build something like below. The only missing piece is the value at the end, near the disclosure indicator. Any idea how to add that value using SwiftUI?
I have a list and the list element is a NavigationLink. I am passing a Binding var to the destination where I select from multiple options the value of that var.
I want to show 'None' in case no selection is done at that moment or the selected value when a selection is done in the destination view.
First of all, you have to include the content inside a Form or a List.
Form {
HStack {
Text("Label")
TextField("Label", text: $label)
.multilineTextAlignment(.trailing)
}
}
Form {
NavigationLink {
DestinationView()
} label: {
Text("Category")
.badge("None") // this will show the secondary text near the disclosure indicator
}
}
And then you can play form here and display as badge the content you want (a selection made in the destionation).