I have a custom keyboard extension. This function is called when the delete key is pressed:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0),
{
for _ in 1..<50
{
(self.textDocumentProxy as UIKeyInput).deleteBackward()
}
print("Deletion End")
self.deleteCounter = 0
})
I do not think the dispatch_async
is relevent but I included it, just incase.
The problem is that even though my console prints "Deletion End" once the loop is finished, the UI of the textfield does not update until a second or two has passed.
It seems calling
(self.textDocumentProxy as UIKeyInput).deleteBackward()
Does not immediately delete a character and update the UI.
How can I be notified when the UI is actually updated?