Quantcast
Channel: Active questions tagged uipickerview - Stack Overflow
Viewing all articles
Browse latest Browse all 592

SwiftUI picker with no title

$
0
0

I'm trying to add a simple picker functionality by SwiftUI. Essentially the outcome I'm looking for is something like this:enter image description here

When clicking on the arrow, it should take user to a new view where they select the required unit.

I tried something like this:

var units = ["ltr", "usg", "impg"]@State private var selectedUnit = 0var body: some View {    Form {        Section {            VStack {                Picker(selection: $selectedUnit, label: Text("")) {                    ForEach(0 ..< units.count) {                        Text(self.units[$0])                    }                }.frame(width: 42)            }        }    }.navigationBarTitle("Select unit")}

But the as soon as this is wrapped in a form, it requires the title etc. and takes up too much space. I simply want to have the units as my base view. Is there any way to accomplish this?


Viewing all articles
Browse latest Browse all 592

Trending Articles