Trait UITextSearching

Source
pub unsafe trait UITextSearching: NSObjectProtocol + MainThreadOnly {
Show 13 methods // Provided methods unsafe fn selectedTextRange(&self) -> Option<Retained<UITextRange>> where Self: Sized + Message { ... } unsafe fn compareFoundRange_toRange_inDocument( &self, found_range: &UITextRange, to_range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, ) -> NSComparisonResult where Self: Sized + Message { ... } unsafe fn performTextSearchWithQueryString_usingOptions_resultAggregator( &self, string: &NSString, options: &UITextSearchOptions, aggregator: &ProtocolObject<dyn UITextSearchAggregator>, ) where Self: Sized + Message { ... } unsafe fn decorateFoundTextRange_inDocument_usingStyle( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, style: UITextSearchFoundTextStyle, ) where Self: Sized + Message { ... } unsafe fn clearAllDecoratedFoundText(&self) where Self: Sized + Message { ... } unsafe fn supportsTextReplacement(&self) -> bool where Self: Sized + Message { ... } unsafe fn shouldReplaceFoundTextInRange_inDocument_withText( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, replacement_text: &NSString, ) -> bool where Self: Sized + Message { ... } unsafe fn replaceFoundTextInRange_inDocument_withText( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, replacement_text: &NSString, ) where Self: Sized + Message { ... } unsafe fn replaceAllOccurrencesOfQueryString_usingOptions_withText( &self, query_string: &NSString, options: &UITextSearchOptions, replacement_text: &NSString, ) where Self: Sized + Message { ... } unsafe fn willHighlightFoundTextRange_inDocument( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, ) where Self: Sized + Message { ... } unsafe fn scrollRangeToVisible_inDocument( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, ) where Self: Sized + Message { ... } unsafe fn selectedTextSearchDocument( &self, ) -> Option<Retained<UITextSearchDocumentIdentifier>> where Self: Sized + Message { ... } unsafe fn compareOrderFromDocument_toDocument( &self, from_document: &UITextSearchDocumentIdentifier, to_document: &UITextSearchDocumentIdentifier, ) -> NSComparisonResult where Self: Sized + Message { ... }
}
Available on crate feature UITextSearching only.
Expand description

Provided Methods§

Source

unsafe fn selectedTextRange(&self) -> Option<Retained<UITextRange>>
where Self: Sized + Message,

Available on crate feature UITextInput only.

Overlap from UITextInput: Returns the currently selected text range, if applicable. Nil otherwise.

Source

unsafe fn compareFoundRange_toRange_inDocument( &self, found_range: &UITextRange, to_range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, ) -> NSComparisonResult
where Self: Sized + Message,

Available on crate feature UITextInput only.

Provide a comparison result comparing developer-provided fromRangeto toRange. This is used by the system find panel to know which UITextRangeto highlight next when the user taps the “next” or “previous” result buttons.

Parameter foundRange: Developer-provided range to compare from.

Parameter toRange: Developer-provided range to compare to.

Parameter document: If multiple documents are used, a document identifier will be provided here. Ranges are only compared between other ranges of the same document.

Source

unsafe fn performTextSearchWithQueryString_usingOptions_resultAggregator( &self, string: &NSString, options: &UITextSearchOptions, aggregator: &ProtocolObject<dyn UITextSearchAggregator>, )
where Self: Sized + Message,

Available on crate feature UIFindSession only.

Perform a text search (across all available searchable documents) using string.When results are found, provide the results to aggregator.

Parameter string: The query string to search for

Parameter options: Search options provided by the user.

Parameter aggregator: When results are found, provide them to the aggregator. The aggregator is thread-safe, so you may send it messages on other threads.

Source

unsafe fn decorateFoundTextRange_inDocument_usingStyle( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, style: UITextSearchFoundTextStyle, )
where Self: Sized + Message,

Available on crate feature UITextInput only.

Given a found range, decorate this text appropriately using the provided styletype.

Parameter range: The range of text to decorate.

Parameter document: If multiple documents are used, the relevant document identifier is provided here. Otherwise nil.

Parameter style: A style hint for how to decorate the text. This is ultimately up to the developer, but developers are encouraged to match the system’s appearance (i.e., UITextView) as close as possible.

Source

unsafe fn clearAllDecoratedFoundText(&self)
where Self: Sized + Message,

Called when the current search session has changed or ended, with the expectation that all decorations applied via decorateFoundTextRange:usingStyle:are cleared.

Source

unsafe fn supportsTextReplacement(&self) -> bool
where Self: Sized + Message,

Return YES if your searchable item also supports replacement. If this method is unimplemented, it is assumed that text replacement is not supported.

Source

unsafe fn shouldReplaceFoundTextInRange_inDocument_withText( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, replacement_text: &NSString, ) -> bool
where Self: Sized + Message,

Available on crate feature UITextInput only.

Optionally return NO to disallow the replacement of a particular result range. This will disable the “replace” button in the UI. If this method is unimplemented, it is assumed that all results are replaceable.

Parameter range: Range to replace.

Parameter document: If multiple documents are used, the document from which range originates.

Parameter replacementText: Text that the user intends to replace with.

Source

unsafe fn replaceFoundTextInRange_inDocument_withText( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, replacement_text: &NSString, )
where Self: Sized + Message,

Available on crate feature UITextInput only.

If you return YES for -supportsTextReplacement, this method will be called whenever the user intends to replace a range of text.

Parameter range: The range of text requesting to be replaced.

Parameter document: If multiple search documents are used, the relevant document identifier is provided here. Otherwise nil.

Parameter replacementText: The replacement string.

Source

unsafe fn replaceAllOccurrencesOfQueryString_usingOptions_withText( &self, query_string: &NSString, options: &UITextSearchOptions, replacement_text: &NSString, )
where Self: Sized + Message,

Available on crate feature UIFindSession only.

When replacing all occurrences at once, this method is called instead of the one above.

Parameter queryString: The search term to replace.

Parameter options: Search options provided by the find panel UI.

Parameter replacementText: The string to replace it with.

Source

unsafe fn willHighlightFoundTextRange_inDocument( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, )
where Self: Sized + Message,

Available on crate feature UITextInput only.

Called when the highlighted search result is about to change to range.

Source

unsafe fn scrollRangeToVisible_inDocument( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, )
where Self: Sized + Message,

Available on crate feature UITextInput only.

If scrolling is supported, implement this to know when the document should be scrolled to a particular search result.

Parameter range: The text range to scroll to.

Parameter document: (Optional) If multiple documents are used, the document identifier to scroll to.

Source

unsafe fn selectedTextSearchDocument( &self, ) -> Option<Retained<UITextSearchDocumentIdentifier>>
where Self: Sized + Message,

Returns the current search document, if applicable. Nil otherwise.

Source

unsafe fn compareOrderFromDocument_toDocument( &self, from_document: &UITextSearchDocumentIdentifier, to_document: &UITextSearchDocumentIdentifier, ) -> NSComparisonResult
where Self: Sized + Message,

Returns the visible ordering from fromDocument to toDocument. If your document identifiers are index paths, for example, this would yield the same result as -[NSIndexPath compare:].

Trait Implementations§

Source§

impl ProtocolType for dyn UITextSearching

Source§

const NAME: &'static str = "UITextSearching"

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 UITextSearching

Implementations on Foreign Types§

Source§

impl<T> UITextSearching for ProtocolObject<T>
where T: ?Sized + UITextSearching,

Implementors§

Source§

impl UITextSearching for UITextView

Available on crate feature UITextView only.