UIScribbleInteractionDelegate

Trait UIScribbleInteractionDelegate 

Source
pub unsafe trait UIScribbleInteractionDelegate: NSObjectProtocol + MainThreadOnly {
    // Provided methods
    fn scribbleInteraction_shouldBeginAtLocation(
        &self,
        interaction: &UIScribbleInteraction,
        location: CGPoint,
    ) -> bool
       where Self: Sized + Message { ... }
    fn scribbleInteractionShouldDelayFocus(
        &self,
        interaction: &UIScribbleInteraction,
    ) -> bool
       where Self: Sized + Message { ... }
    fn scribbleInteractionWillBeginWriting(
        &self,
        interaction: &UIScribbleInteraction,
    )
       where Self: Sized + Message { ... }
    fn scribbleInteractionDidFinishWriting(
        &self,
        interaction: &UIScribbleInteraction,
    )
       where Self: Sized + Message { ... }
}
Available on crate feature UIScribbleInteraction only.
Expand description

Provided Methods§

Source

fn scribbleInteraction_shouldBeginAtLocation( &self, interaction: &UIScribbleInteraction, location: CGPoint, ) -> bool
where Self: Sized + Message,

Available on crate feature objc2-core-foundation only.

Allows the delegate to prevent Scribble from starting at a specific location in the view. If not implemented, defaults to YES. You can use this callback to temporarily suppress Scribble in text input views if your app supports drawing over text or other special interaction when using Apple Pencil. In cases like this, it’s recommended to provide a UI affordance for the user to toggle between drawing and handwriting. This callback can also return NO for views that handle Pencil events directly, like a drawing canvas, since nearby text fields could take over the Pencil events for writing.

Parameter interaction: The interaction asking if it can begin handling user input.

Parameter location: The location in the interaction’s view coordinate system.

Returns: Return NO to disallow writing at the specified location.

Source

fn scribbleInteractionShouldDelayFocus( &self, interaction: &UIScribbleInteraction, ) -> bool
where Self: Sized + Message,

Allow the delegate to delay focusing (making first responder) the text input view. Normally, Scribble will focus the target input 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 text input view will shift or transform when becoming first responder, 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.

Returns: Return YES to delay focusing the text input.

Source

fn scribbleInteractionWillBeginWriting( &self, interaction: &UIScribbleInteraction, )
where Self: Sized + Message,

Will be called when the user begins writing into the interaction’s view. This call will always be paired with a corresponding call to scribbleInteractionDidFinishWriting:. 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.

Source

fn scribbleInteractionDidFinishWriting( &self, interaction: &UIScribbleInteraction, )
where Self: Sized + Message,

Will be called when the user finished writing into the interaction’s view, after the last word has been transcribed and committed.

Parameter interaction: The interaction notifying about writing state changes.

Trait Implementations§

Source§

impl ProtocolType for dyn UIScribbleInteractionDelegate

Source§

const NAME: &'static str = "UIScribbleInteractionDelegate"

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 UIScribbleInteractionDelegate

Implementations on Foreign Types§

Source§

impl<T> UIScribbleInteractionDelegate for ProtocolObject<T>

Implementors§