Class
NSTextCheckingResult
An occurrence of textual content found during the analysis of a block of text, such as when matching a regular expression.
SDKs
- iOS 4.0+
- macOS 10.6+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Overview
On both iOS and macOS, instances of NSTextCheckingResult
are returned by the NSRegularExpression
class and the NSDataDetector
class to indicate the discovery of content. In those cases, what is found may be a match for a regular expression or a date, address, phone number, and so on. In macOS, instances of NSTextCheckingResult
are returned by the NSSpellChecker
object to describe the results of spelling, grammar, or text-substitution actions.
Topics
Text Checking Type Range and Type
Text Checking Results for Text Replacement
Text Checking Results for Regular Expressions
Text Checking Result Components
Text Checking Results for URLs
Text Checking Results for Addresses
Text Checking Results for Transit Information
Text Checking Results for Phone Numbers
Text Checking Results for Dates and Times
Text Checking Results for Typography
Text Checking Results for Spelling
Text Checking Results for Orthography
Text Checking Results for Grammar
Adjusting the Ranges of a Text Checking Result
Constants
typealias NSTextCheckingTypes
Defines the types of checking that are available. These values can be combined using the C-bitwise OR operator. The system supports its own internal types, and the user can extend those types by subclassing NSTextCheckingResult
and adding their own custom types.
See Also
Pattern Matching
class Scanner
A string parser that scans for substrings or characters in a character set, and for numeric values from decimal, hexadecimal, and floating-point representations.
class NSDataDetector
A specialized regular expression object that matches natural language text for predefined data patterns.
let NSNotFound: Int
A value indicating that a requested item couldn’t be found or doesn’t exist.