Instance Method


Performs linguistic analysis on the specified string by enumerating the specific range of the string, providing the Block with the located tags.


func enumerateLinguisticTags(in range: NSRange, scheme: NSLinguisticTagScheme, options: NSLinguisticTagger.Options = [], orthography: NSOrthography?, using block: (NSLinguisticTag?, NSRange, NSRange, UnsafeMutablePointer<ObjCBool>) -> Void)



The range of the string to analyze.


The tag scheme to use. See Linguistic Tag Schemes for supported values.


The linguistic tagger options to use. See NSLinguisticTagger.Optionsfor the constants. These constants can be combined using the C-Bitwise OR operator.


The orthography of the string. If nil, the linguistic tagger will attempt to determine the orthography from the string content.


The Block to apply to the string.

The block takes four arguments:


The tag scheme for the token. The opts parameter specifies the types of tagger options that are located.


The range of a string matching the tag scheme.


The range of the sentence in which the token is found.


A reference to a Boolean value. The block can set the value to true to stop further processing of the array. The stop argument is an out-only argument. You should only ever set this Boolean to true within the Block.


This is a convenience method. It is the equivalent of creating an instance of NSLinguisticTagger, specifying the receiver as the string to be analyzed, and the orthography (or nil) and then invoking the NSLinguisticTagger method or enumerateTags(in:scheme:options:using:).

See Also

Performing Linguistic Analysis

struct NSString.EnumerationOptions

Constants to specify kinds of substrings and styles of enumeration.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software