【问题标题】:Detecting changes in Textfield swiftUI检测 Textfield swiftUI 中的变化
【发布时间】:2022-06-18 01:13:21
【问题描述】:

我希望当用户在文本字段中更改时,将调用特定的func。我尝试了 is 代码,但它不起作用:

TextField("Search barcode number here", text: $SearchText).onChange(of: SearchText, perform: { newValue in
           orderViewModel.fictchItem(ItemId: newValue)}) 

有没有其他方法可以检测到文本字段的变化?

谢谢!

【问题讨论】:

  • 它应该可以工作,所以问题出在其他地方。提供最小的可重现示例进行调试。

标签: ios swift swiftui


猜你喜欢
  • 2020-01-12
  • 2020-03-21
  • 1970-01-01
  • 2020-02-08
  • 2021-10-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-11
相关资源
最近更新 更多