QRCodeCollector

public class QRCodeCollector : Collector, @unchecked Sendable

A display-only collector that provides a QR code image in DaVinci authentication flows.

The server sends the image as a data URI in the content field, e.g.: "data:image/png;base64,iVBORw0KGgo..."

The imageData property exposes the decoded Data after stripping the data URI prefix, allowing the UI layer to render it as a UIImage or SwiftUI.Image.

The fallbackText property carries an alternative string (e.g. a manual entry code or a URL) to display if the QR code cannot be rendered or scanned.

This collector does not participate in form submission — payload() always returns nil.

Collector

  • id

    Declaration

    Swift

    public var id: String { get }

Properties

  • key

    The key identifying this collector within the form.

    Declaration

    Swift

    public private(set) var key: String { get }
  • The decoded QR code image bytes, or nil if the content field was absent or invalid.

    Use UIImage(data:) or Image(uiImage:) in the UI layer to render this as an image.

    Declaration

    Swift

    public private(set) var imageData: Data? { get }
  • Alternative text to display when the QR code cannot be rendered or scanned. Typically a URL or manual entry code. Empty string if not provided by the server.

    Declaration

    Swift

    public private(set) var fallbackText: String { get }

Init

  • Declaration

    Swift

    public required init(with json: [String : Any])

Collector protocol

  • No-op: this collector is display-only and does not accept user input.

    Declaration

    Swift

    public func initialize(with value: Any)
  • Returns nil — QR code collectors are display-only and do not submit a value.

    Declaration

    Swift

    public func payload() -> Never?