I’d like to use this thread to discuss related issue.
When focus, there is a wired padding when using ToolbarItemGroup(placement: .keyboard)
Here is my code:
struct ContentView: View {
@State private var name = ""
@FocusState private var focused: Bool
var body: some View {
VStack {
TextField("輸入名稱", text: $name)
.textFieldStyle(.roundedBorder)
.padding()
.focused($focused)
Spacer()
}
.background(Color(UIColor.systemGroupedBackground))
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
Spacer()
Button("完成") { focused = false }
}
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI