Is it possible to customise the wheel pickers font und change the alignment to .leading
?
Swift UI - Wheel Picker, Change Alignment and Fontsize
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()
}
}
© 2022 - 2024 — McMap. All rights reserved.
Text
, for alignment you can wrap it insideHStack
and + useSpacer
– Closehauled