I m new to SwiftUI. I want to make a TimeZone PickerView for my example project.
After a few day works, I still cannot find a way to achieve my goal, including timezone search bar. I don't know why my code is always stuck. After I choose the first option, and I cannot choose other options again. In this situation, I cannot even click the TimeZone Picker area anymore. It's just stuck without reaction...
Here is my code for now:
struct myPicker: View {
var timezone_area = ["TimeZ1", "TimeZ2", "TimeZ3", "TimeZ4", "TimeZ5", "TimeZ6", "TimeZ7", "TimeZ8", "TimeZ9", "TimeZ10"]
@State var TZPickerIndex: Int = 0
var body: some View {
NavigationView {
Form {
Section {
Picker(selection: $TZPickerIndex, label: Text("TimeZone")) {
ForEach(0 ..< timezone_area.count) {
Text(self.timezone_area[$0]).tag($0)
}
}
}.padding()
}
}
}
}
May somebody tell me that how to make it or which kinds of keyword should I use / search? Thanks for help.