---
title: NSTextCheckingResult
framework: foundation
role: symbol
role_heading: Class
path: foundation/nstextcheckingresult
---

# NSTextCheckingResult

An occurrence of textual content found during the analysis of a block of text, such as when matching a regular expression.

## Declaration

```swift
class NSTextCheckingResult
```

## Overview

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

- [range](foundation/nstextcheckingresult/range.md)
- [resultType](foundation/nstextcheckingresult/resulttype.md)
- [numberOfRanges](foundation/nstextcheckingresult/numberofranges.md)
- [range(at:)](foundation/nstextcheckingresult/range(at:).md)

### Text Checking Results for Text Replacement

- [replacementCheckingResult(range:replacementString:)](foundation/nstextcheckingresult/replacementcheckingresult(range:replacementstring:).md)
- [replacementString](foundation/nstextcheckingresult/replacementstring.md)

### Text Checking Results for Regular Expressions

- [regularExpressionCheckingResult(ranges:count:regularExpression:)](foundation/nstextcheckingresult/regularexpressioncheckingresult(ranges:count:regularexpression:).md)
- [regularExpression](foundation/nstextcheckingresult/regularexpression.md)

### Text Checking Result Components

- [components](foundation/nstextcheckingresult/components.md)

### Text Checking Results for URLs

- [linkCheckingResult(range:url:)](foundation/nstextcheckingresult/linkcheckingresult(range:url:).md)
- [url](foundation/nstextcheckingresult/url.md)

### Text Checking Results for Addresses

- [addressCheckingResult(range:components:)](foundation/nstextcheckingresult/addresscheckingresult(range:components:).md)
- [addressComponents](foundation/nstextcheckingresult/addresscomponents.md)

### Text Checking Results for Transit Information

- [transitInformationCheckingResult(range:components:)](foundation/nstextcheckingresult/transitinformationcheckingresult(range:components:).md)

### Text Checking Results for Phone Numbers

- [phoneNumberCheckingResult(range:phoneNumber:)](foundation/nstextcheckingresult/phonenumbercheckingresult(range:phonenumber:).md)
- [phoneNumber](foundation/nstextcheckingresult/phonenumber.md)

### Text Checking Results for Dates and Times

- [dateCheckingResult(range:date:)](foundation/nstextcheckingresult/datecheckingresult(range:date:).md)
- [dateCheckingResult(range:date:timeZone:duration:)](foundation/nstextcheckingresult/datecheckingresult(range:date:timezone:duration:).md)
- [date](foundation/nstextcheckingresult/date.md)
- [duration](foundation/nstextcheckingresult/duration.md)
- [timeZone](foundation/nstextcheckingresult/timezone.md)

### Text Checking Results for Typography

- [dashCheckingResult(range:replacementString:)](foundation/nstextcheckingresult/dashcheckingresult(range:replacementstring:).md)
- [quoteCheckingResult(range:replacementString:)](foundation/nstextcheckingresult/quotecheckingresult(range:replacementstring:).md)

### Text Checking Results for Spelling

- [spellCheckingResult(range:)](foundation/nstextcheckingresult/spellcheckingresult(range:).md)
- [correctionCheckingResult(range:replacementString:)](foundation/nstextcheckingresult/correctioncheckingresult(range:replacementstring:).md)

### Text Checking Results for Orthography

- [orthographyCheckingResult(range:orthography:)](foundation/nstextcheckingresult/orthographycheckingresult(range:orthography:).md)
- [orthography](foundation/nstextcheckingresult/orthography.md)

### Text Checking Results for Grammar

- [grammarCheckingResult(range:details:)](foundation/nstextcheckingresult/grammarcheckingresult(range:details:).md)
- [grammarDetails](foundation/nstextcheckingresult/grammardetails.md)

### Adjusting the Ranges of a Text Checking Result

- [adjustingRanges(offset:)](foundation/nstextcheckingresult/adjustingranges(offset:).md)

### Constants

- [Keys for Transit Components](foundation/keys-for-transit-components.md)
- [Keys for Address Components](foundation/keys-for-address-components.md)
- [NSTextCheckingResult.CheckingType](foundation/nstextcheckingresult/checkingtype.md)
- [NSTextCheckingTypes](foundation/nstextcheckingtypes.md)
- [NSTextCheckingKey](foundation/nstextcheckingkey.md)
- [Anonymous](foundation/1476845-anonymous.md)

### Initializers

- [init(coder:)](foundation/nstextcheckingresult/init(coder:).md)

### Instance Properties

- [alternativeStrings](foundation/nstextcheckingresult/alternativestrings.md)

### Instance Methods

- [range(withName:)](foundation/nstextcheckingresult/range(withname:).md)

### Type Methods

- [correctionCheckingResult(range:replacementString:alternativeStrings:)](foundation/nstextcheckingresult/correctioncheckingresult(range:replacementstring:alternativestrings:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Pattern Matching

- [Scanner](foundation/scanner.md)
- [NSRegularExpression](foundation/nsregularexpression.md)
- [NSDataDetector](foundation/nsdatadetector.md)
- [NSNotFound](foundation/nsnotfound-4qp9h.md)
