I am using SwiftUI and bridge to UITextField (I need to assign firstResponder). I use the code from here: SwiftUI: How to make TextField become first responder?
The following code updates my @Binding var. This of course is intended behavior. The problem is that this causes the textField to ignore the frame/ bounds. It just expands and pushes other elements out of the view. Other parts of the view are also reliant on the @State.
func textFieldDidChangeSelection(_ textField: UITextField) { …Run Code Online (Sandbox Code Playgroud) 有谁知道如何给分钟 DatePicker 一个间隔?我试图只显示 15 的倍数(0、15、30、45)。这是否只能通过与 UIKit 接口来实现?
我相信它没有使用in: ...Date()零件,至少我想不出解决方案。这是我的片段:
DatePicker(
"",
selection: $selectedDate,
/*in: ...Date(),*/
displayedComponents: .hourAndMinute
)
Run Code Online (Sandbox Code Playgroud)
非常感谢!