Type Method

dataDetectorWithTypes:error:

Creates and returns a new data detector instance.

Declaration

+ (NSDataDetector *)dataDetectorWithTypes:(NSTextCheckingTypes)checkingTypes error:(NSError * _Nullable *)error;

Parameters

checkingTypes

The checking types. The supported checking types are a subset of the types specified in NSTextCheckingType. Those constants can be combined using the C-bitwise OR operator.

error

An out parameter that if an error occurs during initialization contains the encountered error.

Return Value

Returns the newly initialized data detector. If an error was encountered returns nil, and error contains the error.

Discussion

Currently, the supported data detectors checkingTypes are: NSTextCheckingTypeDate, NSTextCheckingTypeAddress, NSTextCheckingTypeLink, NSTextCheckingTypePhoneNumber, and NSTextCheckingTypeTransitInformation.

See Also

Creating Data Detector Instances

- initWithTypes:error:

Initializes and returns a data detector instance.