indirectScribbleInteraction(_:focusElementIfNeeded:referencePoint:completion:)
Asks the delegate to focus an element to handle text edits.
Declaration
func indirectScribbleInteraction(_ interaction: any UIInteraction, focusElementIfNeeded elementIdentifier: Self.ElementIdentifier, referencePoint focusReferencePoint: CGPoint, completion: @escaping ((any UIResponder & UITextInput)?) -> Void)Parameters
- interaction:
The interaction requesting to focus an element.
- elementIdentifier:
The identifier of the element that should receive focus.
- focusReferencePoint:
A Cgpoint inside the element’s view.
- completion:
A completion handler that you must call, either synchronously or asynchronously. On success, the first parameter should be the text input that became first responder and that handles text operations for this element. On failure, call the completion with a
nilparameter.
Return Value
In response to this callback, the implementation should make this element the currently focused one, and make the corresponding UITextInput become first responder.
If the element isn’t focused already, set the text selection to the character location closest to focusReferencePoint to avoid any scrolling or shifting of content.
If the element is already focused, make no changes to the selection. Before returning you must still call the completion handler with a reference to UITextInput.