Hello everyone,
we recently encountered an issue attempting to implement a text field in our SwiftUI app. We have the view setup so that the text field is at the bottom of the screen. Using SwiftUI's implicit keyboard avoidance, the textfield correctly moves up with the keyboard when the keyboard is shown.
This is working fine, except for one edge case: Text replacement (or correction, I'm unsure about what this feature is called). If the user has entered a wrong word (it is underlined in red), then taps on that word, it is highlighted in red, and a popup with possible replacements is shown.
If the user has the keyboard closed and then attempts to open text replacement for a word, the keyboard will move up, and the popup will show. However, it seems that the popup shows while the keyboard animation is still playing. This leads to the popup having an offset to the word it should be pointing to, see this screenshot:
I have provided a minimal code example on GitHub, to reproduce this error. https://github.com/TomQDRS/text-replacement-benchmark-ios
Is Apple aware of this? I can't imagine this being wanted behaviour. Has anyone encountered this issue and come up with a workaround? Is there a way to disable text replacement for a textview?