如何实现连续滚动的选择器?因此,现在此代码在“ 9”处停止,您必须再次上升。我希望看到在'9'之后又有一个'0','1'等。
import SwiftUI
struct TestView: View {
var digitArray = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
@State private var digit = 3
var body: some View {
VStack {
Picker(selection: $digit, label: Text("Choose a digit")) {
ForEach(0 ..< digitArray.count) {
Text(self.digitArray[$0]).tag($0)
}
}
Text("You selected: \(digitArray[digit])")
}
}
}
#if DEBUG
struct TestView_Previews: PreviewProvider {
static var previews: some View {
TestView()
}
}
#endif