SBSDKGenericDocument

@interface SBSDKGenericDocument : NSObject

A generic document. Contains fields and sub-documents.

  • The documents type.

    Declaration

    Objective-C

    @property (nonatomic, strong, nonnull) SBSDKGenericDocumentType *type;

    Swift

    var type: SBSDKGenericDocumentType { get set }
  • A list of the documents fields.

    Declaration

    Objective-C

    @property (nonatomic, strong, nonnull) NSArray<SBSDKGenericDocumentField *> *fields;

    Swift

    var fields: [SBSDKGenericDocumentField] { get set }
  • A list of the documents sub-documents.

    Declaration

    Objective-C

    @property (nonatomic, strong, nonnull) NSArray<SBSDKGenericDocument *> *children;

    Swift

    var children: [SBSDKGenericDocument] { get set }
  • The average confidence in the accuracy of the document recognition result.

    Declaration

    Objective-C

    @property float confidence;

    Swift

    var confidence: Float { get set }
  • The weight of the confidence. Can be used to calculate the weighted average confidence of two or more documents.

    Declaration

    Objective-C

    @property float confidenceWeight;

    Swift

    var confidenceWeight: Float { get set }
  • Returns a field given its local or common type name. Returns nil if not found.

    Declaration

    Objective-C

    - (nullable SBSDKGenericDocumentField *)fieldByTypeName:
        (nonnull NSString *)name;

    Swift

    func field(byTypeName name: String) -> SBSDKGenericDocumentField?
  • Returns all fields given a local or common field type name.

    Declaration

    Objective-C

    - (nonnull NSArray<SBSDKGenericDocumentField *> *)fieldsByTypeName:
        (nonnull NSString *)name;

    Swift

    func fields(byTypeName name: String) -> [SBSDKGenericDocumentField]
  • Returns a sub-document given its document type name. Returns nil if not found.

    Declaration

    Objective-C

    - (nullable SBSDKGenericDocument *)childByDocumentType:(nonnull NSString *)name;

    Swift

    func child(byDocumentType name: String) -> SBSDKGenericDocument?
  • Generates a flat array of the document and its child documents recursively. Can be used for displaying the documents fields in a table view.

    Declaration

    Objective-C

    - (nullable NSArray<SBSDKGenericDocument *> *)
        flatDocumentIncludingEmptyChildren:(BOOL)includeEmptyChildren
                      includingEmptyFields:(BOOL)includeEmptyFields;

    Swift

    func flatDocument(includingEmptyChildren includeEmptyChildren: Bool, includingEmptyFields includeEmptyFields: Bool) -> [SBSDKGenericDocument]?

    Parameters

    includeEmptyChildren

    If set to YES, child documents without fields are included, otherwise NO.

    includeEmptyFields

    If set to YES, fields with no values are included, otherwise NO.

    Return Value

    An array of the child documents with the main document in the first position.

  • Generates a flat array of the document fields and its child documents fields recursively. Can be used for displaying the documents fields in a table view.

    Declaration

    Objective-C

    - (nullable NSArray<SBSDKGenericDocumentField *> *)
        allFieldsIncludingEmptyFields:(BOOL)includeEmptyFields;

    Swift

    func allFields(includingEmptyFields includeEmptyFields: Bool) -> [SBSDKGenericDocumentField]?

    Parameters

    includeEmptyFields

    If set to YES, fields with no values are included, otherwise NO.

    Return Value

    An array of all the fields in the document.