Parser
Defined in framework ScanditParser
- Parser
open class Parser : NSObject, DataCaptureComponent
Added in version 6.1.0
- init
convenience init(context: DataCaptureContext, format dataFormat: ParserDataFormat) throws
Added in version 6.1.0
Create new parser for the provided data format and context. The license key with which the data capture context was constructed must have the parser feature enabled.
In case the parser could not be created, more detailed information on why creation failed is stored in the error argument, if non-null.
- init
convenience init(fromJSONString JSONString: String, context: DataCaptureContext) throws
Added in version 6.3.0
Construct a new parser with the provided JSON serialization.
- parseString
open func parseString(_ string: String) throws -> ParsedData
Added in version 6.1.0
Parses the data string and returns the contained field in the result object. Typical inputs to this method is the data contained in a barcode (see Barcode.data)
In case the data string could not be parsed, the error message is contained in the error parameter.
- parseRawData
open func parseRawData(_ data: Data) throws -> ParsedData
Added in version 6.1.0
Parses the raw data and returns the contained field in the result object. Typical inputs to this method is the raw data of a barcode (see Barcode.rawData).
In case the data string could not be parsed, the error message is contained in the error parameter.
- setOptions
open func setOptions(_ options: Dictionary<String, NSObject>) throws ->
VoidAdded in version 6.1.0
Set the provided options on the parser.
Available options depend on the data format type of the parser and are documented for each of the supported data formats.
In case the options are invalid, this method returns false and the error argument is filled with more information on the failure.