<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIIndirectScribbleInteractionDelegate-hdh/indirectScribbleInteraction(_:focusElementIfNeeded:referencePoint:completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:5UIKit37UIIndirectScribbleInteractionDelegateP08indirectcD0_20focusElementIfNeeded14referencePoint10completionySo13UIInteraction_p_0H10IdentifierQzSo7CGPointVySo11UITextInput_So11UIResponderCXcSgctF"
  },
  "title" : "indirectScribbleInteraction(_:focusElementIfNeeded:referencePoint:completion:)"
}
-->

# indirectScribbleInteraction(_:focusElementIfNeeded:referencePoint:completion:)

Asks the delegate to focus an element to handle text edits.

```
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 <doc://com.apple.documentation/documentation/CoreFoundation/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 `nil` parameter.

## Return Value

In response to this callback, the implementation should make this element the currently focused one, and make the corresponding [`UITextInput`](/documentation/UIKit/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`](/documentation/UIKit/UITextInput).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)