0

i have a picker in form which is enclosed in Navigation View. The Picker item displays disclosure button with label text in it.

enter image description here

Is there any way we can hide the label that is associated with disclosure button?. For example in the above image i want hide Rome label.

ejejes
  • 29
  • 4

1 Answers1

0

No, you can't hide the selected value. But you can use NavigationLink as a work-around:

struct ContentView: View {
    
    @State private var input = ""
    @State private var active = false

    var body: some View {
        NavigationView {
            Form {
                NavigationLink("What is your favourite city?", isActive: $active) {
                    List {
                        Button("Rome") {
                            input = "Rome"
                            active = false
                        }
                        Button("Paris") {
                            input = "Paris"
                            active = false
                        }
                        Button("Berlin") {
                            input = "Berlin"
                            active = false
                        }
                        Button("New York") {
                            input = "New York"
                            active = false
                        }
                    }
                }
            }
        }
    }
}
ChrisR
  • 9,523
  • 1
  • 8
  • 26