I have a TextField
with a fixed-size frame, but it still expands to wrap the entered text, even over siblings.
Initial state:
With some input:
Is there a way to prevent this in SwiftUI using TextField
or do I need to resort to ViewRepresentable?
My code for this layout looks something like:
HStack(spacing: 0) {
Text("1").fixedSize(horizontal: true, vertical: false).frame(width: 22)
TextField("Price", text: $text1).fixedSize(horizontal: true, vertical: false).frame(width: 70)
TextField("1", text: $text2).fixedSize(horizontal: true, vertical: false).frame(width: 30)
TextField("1", text: $text3).fixedSize(horizontal: true, vertical: false).frame(width: 70)
}.textFieldStyle(RoundedBorderTextFieldStyle())
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…