I’ve been having some issues closing the iOS keyboard. I have
Copy code
ComposeView()
.ignoresSafeArea(.keyboard)
However after a lot of searching it doesn’t seem like any scroll to dismiss solution works. What have other people done for this?
j
james
01/06/2025, 6:29 AM
you can create a custom modifier that uses a customised
detectDragGestures
function which does not consume touch events
when you detect a drag gesture, hide the software keyboard
this doesn’t give the same UX as native iOS but the overall behaviour will be similar
b
blakelee
01/07/2025, 4:35 AM
It doesn’t seem like there’s any native-like ways to do this and I don’t know enough about iOS dev to create my own
a
Andy Dent
02/14/2025, 2:42 AM
If you’re doing things like this be careful about testing on different iOS versions.
Maybe this is only a SwiftUI issue but I had a lot of woes recently with custom ways to detect focus changes, that worked fine on iOS18 but not 17 or 16.
b
blakelee
02/14/2025, 2:49 AM
I experienced this also. I ended up not finding a good solution to this so I’m being careful with all of my text to make sure they have keyboard actions