Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift UI - Wheel Picker, Change Alignment and Fontsize

Is it possible to customise the wheel pickers font und change the alignment to .leading?

like image 547
Daniel Avatar asked Jan 26 '23 02:01

Daniel


1 Answers

I think this will be what you expect.

struct ContentView: View {
    let colors = ["Red", "Yellow", "Green", "Gray", "Black", "Purple", "White", "Brown", "Pink", "Blue"]
    @State private var color = "Red"
    var body: some View {
        Picker(selection: $color, label: Text("")) {
            ForEach(self.colors, id: \.self) { color in
                HStack {
                    Text(color)
                        .font(.title)
                        .padding()
                    Spacer()
                }
            }
        }
        .pickerStyle(WheelPickerStyle())
        .labelsHidden()
    }
}
like image 157
Dscyre Scotti Avatar answered Feb 08 '23 16:02

Dscyre Scotti