Trait UIIndirectScribbleInteractionDelegate

Source
pub unsafe trait UIIndirectScribbleInteractionDelegate: NSObjectProtocol + MainThreadOnly {
    // Provided methods
    unsafe fn indirectScribbleInteraction_requestElementsInRect_completion(
        &self,
        interaction: &UIIndirectScribbleInteraction,
        rect: CGRect,
        completion: &Block<dyn Fn(NonNull<NSArray<UIScribbleElementIdentifier>>)>,
    )
       where Self: Sized + Message { ... }
    unsafe fn indirectScribbleInteraction_isElementFocused(
        &self,
        interaction: &UIIndirectScribbleInteraction,
        element_identifier: &UIScribbleElementIdentifier,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn indirectScribbleInteraction_frameForElement(
        &self,
        interaction: &UIIndirectScribbleInteraction,
        element_identifier: &UIScribbleElementIdentifier,
    ) -> CGRect
       where Self: Sized + Message { ... }
    unsafe fn indirectScribbleInteraction_focusElementIfNeeded_referencePoint_completion(
        &self,
        interaction: &UIIndirectScribbleInteraction,
        element_identifier: &UIScribbleElementIdentifier,
        focus_reference_point: CGPoint,
        completion: &Block<dyn Fn(*mut UIResponder)>,
    )
       where Self: Sized + Message { ... }
    unsafe fn indirectScribbleInteraction_shouldDelayFocusForElement(
        &self,
        interaction: &UIIndirectScribbleInteraction,
        element_identifier: &UIScribbleElementIdentifier,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn indirectScribbleInteraction_willBeginWritingInElement(
        &self,
        interaction: &UIIndirectScribbleInteraction,
        element_identifier: &UIScribbleElementIdentifier,
    )
       where Self: Sized + Message { ... }
    unsafe fn indirectScribbleInteraction_didFinishWritingInElement(
        &self,
        interaction: &UIIndirectScribbleInteraction,
        element_identifier: &UIScribbleElementIdentifier,
    )
       where Self: Sized + Message { ... }
}
Available on crate feature UIIndirectScribbleInteraction only.
Expand description

The protocol to be implemented by the delegate of UIIndirectScribbleInteraction. It will be responsible for supplying a list of writable elements, focusing them, and ultimately providing a real UITextInput that will handle text editing operations.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn indirectScribbleInteraction_requestElementsInRect_completion( &self, interaction: &UIIndirectScribbleInteraction, rect: CGRect, completion: &Block<dyn Fn(NonNull<NSArray<UIScribbleElementIdentifier>>)>, )
where Self: Sized + Message,

Available on crate features block2 and objc2-core-foundation only.

This method will be called to request the text input elements in a certain rect of the view, each of which represents an area where the user can start writing even if it’s not a text input field itself.

Parameter interaction: The interaction asking for the elements.

Parameter rect: The rect around the area where the user is trying to write, in the interaction’s view coordinate system. Only elements intersecting this rect should be returned.

Parameter completion: You must call the completion handler, synchronously or asynchronously, with an array of identifiers of the available elements, or an empty array if no elements are available.

Source

unsafe fn indirectScribbleInteraction_isElementFocused( &self, interaction: &UIIndirectScribbleInteraction, element_identifier: &UIScribbleElementIdentifier, ) -> bool
where Self: Sized + Message,

Asks the delegate if an element is currently focused, according to the internal state of the interaction’s view.

Parameter interaction: The interaction asking for the focused state.

Parameter elementIdentifier: The identifier of the element the interaction is asking about.

Returns: Return YES if the element is the one currently focused.

Source

unsafe fn indirectScribbleInteraction_frameForElement( &self, interaction: &UIIndirectScribbleInteraction, element_identifier: &UIScribbleElementIdentifier, ) -> CGRect
where Self: Sized + Message,

Available on crate feature objc2-core-foundation only.

Asks the delegate to provide the frame of an element.

Parameter interaction: The interaction asking for the element’s frame.

Parameter elementIdentifier: The identifier of the element the interaction is asking about.

Returns: Frame for the element, in the interactions’s view coordinate system.

Source

unsafe fn indirectScribbleInteraction_focusElementIfNeeded_referencePoint_completion( &self, interaction: &UIIndirectScribbleInteraction, element_identifier: &UIScribbleElementIdentifier, focus_reference_point: CGPoint, completion: &Block<dyn Fn(*mut UIResponder)>, )
where Self: Sized + Message,

Available on crate features UIResponder and UITextInput and UITextInputTraits and block2 and objc2-core-foundation only.

Asks the delegate to focus an element to handle text edits. In response, it should make the element the currently focused one, and make the corresponding UITextInput become first responder. If the element was not focused already, text selection should be set to the character location closest to focusReferencePoint, to avoid any scrolling or shifting of content. If the element was focused already, no changes in selection should be made and this call can be ignored, but you must still call the completion handler with a reference to the text input.

Parameter interaction: The interaction that is requesting to focus an element.

Parameter elementIdentifier: The identifier of the element that should be focused.

Parameter completion: You must always call the completion handler, either synchronously or asynchronously. On success, the first parameter should be the text input that became first responder and that will handle text operations for this element. On failure, call the completion with a nil parameter.

Source

unsafe fn indirectScribbleInteraction_shouldDelayFocusForElement( &self, interaction: &UIIndirectScribbleInteraction, element_identifier: &UIScribbleElementIdentifier, ) -> bool
where Self: Sized + Message,

Allow the delegate to delay focusing an element. Normally, Scribble will focus the element as soon as the user begins writing, but if you return YES from this callback, it will wait until the user makes a brief pause. This is useful in cases where the element’s frame will shift or transform when becoming focused, which can be disruptive to a user trying to handwrite into it. Wherever possible it is preferable to adjust the UI behavior to avoid the layout changes, and only use delayed focus as a last resort, since transcription will happen all at once instead of incrementally.

Parameter interaction: The interaction asking about delaying focus.

Parameter elementIdentifier: The identifier of the element the interaction is asking about.

Returns: Return YES to delay focusing the element.

Source

unsafe fn indirectScribbleInteraction_willBeginWritingInElement( &self, interaction: &UIIndirectScribbleInteraction, element_identifier: &UIScribbleElementIdentifier, )
where Self: Sized + Message,

Will be called when the user begins writing into an element. This call will always be paired with a corresponding call to indirectScribbleInteraction:didFinishWritingInElement:. It is recommended to use this call to hide custom placeholders or other UI elements that can interfere with writing.

Parameter interaction: The interaction notifying about writing state changes.

Parameter elementIdentifier: The identifier of the element the user is writing into.

Source

unsafe fn indirectScribbleInteraction_didFinishWritingInElement( &self, interaction: &UIIndirectScribbleInteraction, element_identifier: &UIScribbleElementIdentifier, )
where Self: Sized + Message,

Will be called when the user finished writing into an element, after the last word has been transcribed and committed.

Parameter interaction: The interaction notifying about writing state changes.

Parameter elementIdentifier: The identifier of the element the user finished writing into.

Trait Implementations§

Source§

impl ProtocolType for dyn UIIndirectScribbleInteractionDelegate

Source§

const NAME: &'static str = "UIIndirectScribbleInteractionDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn UIIndirectScribbleInteractionDelegate

Implementations on Foreign Types§

Source§

impl<T> UIIndirectScribbleInteractionDelegate for ProtocolObject<T>

Implementors§