pub unsafe trait UITextSearching: NSObjectProtocol + MainThreadOnly {
Show 13 methods
// Provided methods
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 { ... }
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 { ... }
fn clearAllDecoratedFoundText(&self)
where Self: Sized + Message { ... }
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 { ... }
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 { ... }
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 { ... }
}UITextSearching only.Expand description
Provided Methods§
Sourcefn selectedTextRange(&self) -> Option<Retained<UITextRange>>
Available on crate feature UITextInput only.
fn selectedTextRange(&self) -> Option<Retained<UITextRange>>
UITextInput only.Overlap from UITextInput: Returns the currently selected text range, if applicable. Nil otherwise.
Sourceunsafe fn compareFoundRange_toRange_inDocument(
&self,
found_range: &UITextRange,
to_range: &UITextRange,
document: Option<&UITextSearchDocumentIdentifier>,
) -> NSComparisonResult
Available on crate feature UITextInput only.
unsafe fn compareFoundRange_toRange_inDocument( &self, found_range: &UITextRange, to_range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, ) -> NSComparisonResult
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.
§Safety
document should be of the correct type.
Sourcefn performTextSearchWithQueryString_usingOptions_resultAggregator(
&self,
string: &NSString,
options: &UITextSearchOptions,
aggregator: &ProtocolObject<dyn UITextSearchAggregator>,
)
Available on crate feature UIFindSession only.
fn performTextSearchWithQueryString_usingOptions_resultAggregator( &self, string: &NSString, options: &UITextSearchOptions, aggregator: &ProtocolObject<dyn UITextSearchAggregator>, )
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.
Sourceunsafe fn decorateFoundTextRange_inDocument_usingStyle(
&self,
range: &UITextRange,
document: Option<&UITextSearchDocumentIdentifier>,
style: UITextSearchFoundTextStyle,
)
Available on crate feature UITextInput only.
unsafe fn decorateFoundTextRange_inDocument_usingStyle( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, style: UITextSearchFoundTextStyle, )
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.
§Safety
document should be of the correct type.
Sourcefn clearAllDecoratedFoundText(&self)
fn clearAllDecoratedFoundText(&self)
Called when the current search session has changed or ended, with the expectation that all decorations
applied via
decorateFoundTextRange:usingStyle:are cleared.
Sourcefn supportsTextReplacement(&self) -> bool
fn supportsTextReplacement(&self) -> bool
Return YES if your searchable item also supports replacement. If this method is unimplemented, it is assumed that text replacement is not supported.
Sourceunsafe fn shouldReplaceFoundTextInRange_inDocument_withText(
&self,
range: &UITextRange,
document: Option<&UITextSearchDocumentIdentifier>,
replacement_text: &NSString,
) -> bool
Available on crate feature UITextInput only.
unsafe fn shouldReplaceFoundTextInRange_inDocument_withText( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, replacement_text: &NSString, ) -> bool
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.
§Safety
document should be of the correct type.
Sourceunsafe fn replaceFoundTextInRange_inDocument_withText(
&self,
range: &UITextRange,
document: Option<&UITextSearchDocumentIdentifier>,
replacement_text: &NSString,
)
Available on crate feature UITextInput only.
unsafe fn replaceFoundTextInRange_inDocument_withText( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, replacement_text: &NSString, )
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.
§Safety
document should be of the correct type.
Sourcefn replaceAllOccurrencesOfQueryString_usingOptions_withText(
&self,
query_string: &NSString,
options: &UITextSearchOptions,
replacement_text: &NSString,
)
Available on crate feature UIFindSession only.
fn replaceAllOccurrencesOfQueryString_usingOptions_withText( &self, query_string: &NSString, options: &UITextSearchOptions, replacement_text: &NSString, )
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.
Sourceunsafe fn willHighlightFoundTextRange_inDocument(
&self,
range: &UITextRange,
document: Option<&UITextSearchDocumentIdentifier>,
)
Available on crate feature UITextInput only.
unsafe fn willHighlightFoundTextRange_inDocument( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, )
UITextInput only.Called when the highlighted search result is about to change to
range.
§Safety
document should be of the correct type.
Sourceunsafe fn scrollRangeToVisible_inDocument(
&self,
range: &UITextRange,
document: Option<&UITextSearchDocumentIdentifier>,
)
Available on crate feature UITextInput only.
unsafe fn scrollRangeToVisible_inDocument( &self, range: &UITextRange, document: Option<&UITextSearchDocumentIdentifier>, )
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.
§Safety
document should be of the correct type.
Sourcefn selectedTextSearchDocument(
&self,
) -> Option<Retained<UITextSearchDocumentIdentifier>>
fn selectedTextSearchDocument( &self, ) -> Option<Retained<UITextSearchDocumentIdentifier>>
Returns the current search document, if applicable. Nil otherwise.
Sourceunsafe fn compareOrderFromDocument_toDocument(
&self,
from_document: &UITextSearchDocumentIdentifier,
to_document: &UITextSearchDocumentIdentifier,
) -> NSComparisonResult
unsafe fn compareOrderFromDocument_toDocument( &self, from_document: &UITextSearchDocumentIdentifier, to_document: &UITextSearchDocumentIdentifier, ) -> NSComparisonResult
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:].
§Safety
from_documentshould be of the correct type.to_documentshould be of the correct type.
Trait Implementations§
Source§impl ProtocolType for dyn UITextSearching
impl ProtocolType for dyn UITextSearching
impl<T> ImplementedBy<T> for dyn UITextSearching
Implementations on Foreign Types§
impl<T> UITextSearching for ProtocolObject<T>where
T: ?Sized + UITextSearching,
Implementors§
impl UITextSearching for UITextView
UITextView only.