I’m experiencing issues with a TextField on the vertical axis in SwiftUI. I’m unable to limit the number of lines or characters. Everything works fine when the vertical axis parameter is removed. Here’s my code:
@State private var text = ""
List{
Section {
TextField("placeholder", text: $text, axis: .vertical)
.linelimit(3)
}
}
I also tried to limit characters by going:
@State var textLimit: Int = 10
List{
Section {
TextField("placeholder", text: $text, axis: .vertical)
.onChange(of: text){
text = String(text.prefix(titleLimit))
}
}
}
But nothing seems to work. What am I doing wrong? Thanks.