QRCode
open class QRCode
QRCode abstraction and generator.
-
Error correct level.
Declaration
Swift
public let correctLevel: QRErrorCorrectLevel -
If the image codes has a border around its content.
Declaration
Swift
public let hasBorder: Bool -
Declaration
Swift
public convenience init( _ text: String, encoding: String.Encoding = .utf8, errorCorrectLevel: QRErrorCorrectLevel = .H, withBorder hasBorder: Bool = true ) throwsParameters
textcontent of the QRCode.
encodingencoding used for generating data from text.
errorCorrectLevelerror correct level, defaults to high.
hasBorderif the image codes has a border around, defaults and suggests to be true.
-
Construct a QRCode instance.
Throws
seeQRCodeErrorDeclaration
Swift
public init( _ data: Data, errorCorrectLevel: QRErrorCorrectLevel = .H, withBorder hasBorder: Bool = true ) throwsParameters
dataraw content of the QRCode.
errorCorrectLevelerror correct level, defaults to high.
hasBorderif the image codes has a border around, defaults and suggests to be true.
-
QRCode in binary form.
Declaration
Swift
open private(set) lazy var imageCodes: [[Bool]] { get set } -
Convert QRCode to String.
Declaration
Swift
open func toString(filledWith black: Any, patchedWith white: Any) -> StringParameters
blackrecommend to be “\u{1B}[7m ” or “##”.
whiterecommend to be “\u{1B}[0m ” or “ ”.
Return Value
a matrix of characters that is scannable.
View on GitHub
Install in Dash
QRCode Class Reference