SBSDKMachineReadableCode

@interface SBSDKMachineReadableCode : NSObject

The base class for a machine readable code. Contains string value and metadata. Provides some basic functions to support sharing, opening and displaying QR- or barcode data.

Custom machine readable code parsers return subclasses.

  • The designated initializer.

    Declaration

    Objective-C

    - (instancetype)initWithMetadata:(SBSDKMachineReadableCodeMetadata *)metadata;

    Swift

    init!(metadata: SBSDKMachineReadableCodeMetadata!)
  • Convenience class initializer.

    Declaration

    Objective-C

    + (instancetype)codeWithMetadata:(SBSDKMachineReadableCodeMetadata *)metadata;
  • The underlying metadata object.

    Declaration

    Objective-C

    @property (readonly, nonatomic) SBSDKMachineReadableCodeMetadata *metadata;

    Swift

    var metadata: SBSDKMachineReadableCodeMetadata! { get }
  • The unprocessed string value of the receiver.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSString *stringValue;

    Swift

    var stringValue: String! { get }
  • An URL that can be opened via -[UIApplication openURL] or nil. Subclasses should override this function to return a meaningful URL.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSURL *externalURL;

    Swift

    var externalURL: URL! { get }
  • Whether UIApplication can open the external URL or not.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL canOpenExternally;

    Swift

    var canOpenExternally: Bool { get }
  • An array of objects that are forwareded to an UIActivityViewController when the user hits the share button. Subclasses here provide shareable objects here.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSArray *sharedObjects;

    Swift

    var sharedObjects: [Any]! { get }
  • Opens the externalURL of the receiver via -[UIApplication openURL:]. Does nothing if [UIApplication canOpenURL:] returns NO.

    Declaration

    Objective-C

    - (void)openExternally;

    Swift

    func openExternally()
  • Declaration

    Objective-C

    - (BOOL)isQRCode;

    Swift

    func isQRCode() -> Bool

    Return Value

    YES, if the receiver represents a QR code, NO otherwise.

  • Declaration

    Objective-C

    - (NSString *)type;

    Swift

    func type() -> String!

    Return Value

    A string, describing the type of the receiver. Subclasses should override this method to return a meaningful type description.