How can we override the resetting of cursor position in UITextField?

We have adopted a redux pattern. That means we return false in UITextField's "shouldReplaceCharacters inRange" function. From there we dispatch an UpdateStateAction to our ReSwift store. Then once the reducers have updated the state, we set a new state on our UI. As part of setting the new state, we'll call "textField.text = newValue" on whatever text field was being edited.

Sadly, when you wholesale replace the text on the text field in this way, it resets the insertion point to the end of the text field.

Is there any way to override this annoying behavior? It seems to occur due to the following private method being called under the hood by the private class, UIFieldEditor:

_setAttributedTextInRange:replacementText:andSetCaretSelectionAfterText

How can we avoid this ever being called?

I have found the only valid workaround to be, saving the selected text range's start position as a UITextPosition of the field before the change, and making sure to offset it by however many characters are being added, then to update the selectedTextRange after calling "text = newValue".

However this is kludgy and we don't like it. It's very annoying for UITextField to have such a bizarre, mysterious hidden behavior and seemingly no way to override it.

Surely I'm overlooking some thing?

Thanks

PS—The only workaround I found was this answer from five years go on an unrelated StackOverflow question from six and a half years ago: https://stackoverflow.com/a/29195723/12587089