我正在使用Clockify api,我的问题是在创建新项目时如何设置带有浮点值的估计值: 我为$ estimate变量尝试了各种值;前三个返回错误,但第四组返回146而不是146.76 THX
struct ContentView : View {
@State private var picked: Int = 0
var someData = ["a", "b", "c"]
var body: some View {
let p = Binding<Int>(getValue: {
return self.picked
}, setValue: {
self.picked = $0
// your callback goes here
print("setting value \($0)")
})
return VStack {
Picker(selection: p,
label: Text("")) {
ForEach(0 ..< someData.count) {
Text(self.someData[$0]).tag($0)
}
}
.pickerStyle(.wheel)
Text("you picked: \(someData[picked])")
}
}
}