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 { ... }
}
UITextSearching
only.Expand description
Provided Methods§
Sourceunsafe fn selectedTextRange(&self) -> Option<Retained<UITextRange>>
Available on crate feature UITextInput
only.
unsafe 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
fromRange
to
toRange
. This is used by
the system find panel to know which
UITextRange
to 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.
Sourceunsafe fn performTextSearchWithQueryString_usingOptions_resultAggregator(
&self,
string: &NSString,
options: &UITextSearchOptions,
aggregator: &ProtocolObject<dyn UITextSearchAggregator>,
)
Available on crate feature UIFindSession
only.
unsafe 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
style
type.
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.
Sourceunsafe fn clearAllDecoratedFoundText(&self)
unsafe 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.
Sourceunsafe fn supportsTextReplacement(&self) -> bool
unsafe 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.
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.
Sourceunsafe fn replaceAllOccurrencesOfQueryString_usingOptions_withText(
&self,
query_string: &NSString,
options: &UITextSearchOptions,
replacement_text: &NSString,
)
Available on crate feature UIFindSession
only.
unsafe 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
.
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.
Sourceunsafe fn selectedTextSearchDocument(
&self,
) -> Option<Retained<UITextSearchDocumentIdentifier>>
unsafe 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:]
.
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.