Hello!
When toggling fullSize, the textfield height doesn't change automatically until I write another word in the textfield.
Any temporary solution?
Thank you!
Jean
import SwiftUI
struct ContentView: View {
@State private var description: String = ""
@State private var fullSize: Bool = false
@State private var fullHeight: Bool = false
var body: some View {
VStack(spacing: 0) {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello world!")
}
TextField("Type a textmail", text: $description, axis: .vertical)
.lineLimit(fullSize ? 2...6 : 2...3)
.foregroundColor(.white)
.background(Color.blue)
.frame(height: fullHeight ? 300 : 100)
.padding(0)
Button("Full size") {
fullSize.toggle()
print("fullSize: \(fullSize)")
}
.padding(5)
Button("Full height") {
fullHeight.toggle()
print("fullHeight: \(fullHeight)")
}
.padding(5)
}
}
}