Aim: A ChatGPT-style composer fastened on the backside, all the time above the keyboard, helps interactive dismissal, rising textual content, and iPad undocked/break up keyboards.
Tried:
Pure SwiftUI: .safeAreaInset(.backside) + .scrollDismissesKeyboard(.interactively) → throughout interactive drag the panel typically lags/briefly reveals a spot; rising textual content could cause small jumps.
.toolbar(.keyboard) → not persistent when there’s no focus.
UIKit wrapper with inputAccessoryView by way of UIViewControllerRepresentable → easy, however solely seen whereas a subject is first responder.
Minimal repro (SwiftUI):
import SwiftUI
struct ChatView: View {
@State non-public var textual content = ""
var physique: some View {
Record(0..<40, id: .self) { i in Textual content("Message (i)") }
.safeAreaInset(edge: .backside) {
HStack {
TextField("Message", textual content: $textual content, axis: .vertical)
.lineLimit(1...6)
.textFieldStyle(.roundedBorder)
Button("Ship") {}
}
.padding()
.background(.ultraThinMaterial)
}
.scrollDismissesKeyboard(.interactively)
}
}
Noticed: On iPhone (iOS 17/18) there’s a quick 2–8 px hole/lag vs. keyboard throughout interactive dismissal; on iPad with undocked keyboard the panel could not “observe” the keyboard.
Query: In 2025, is there a pure SwiftUI sample that reliably matches inputAccessoryView habits (together with interactive drag and undocked keyboards), or is the really helpful strategy nonetheless to embed a UIKit controller and use inputAccessoryView? Tips that could Apple docs or pattern code appreciated.
Atmosphere: Xcode 15/16, Swift 5.9/5.10, iOS 17