Using QRCode in your project QRCode / QRCodeDynamic Let loadedDoc = try QRCode.Document(jsonData: jsonData) Save a JSON representation of the qrcode document Let pdfdata = doc.pdfData(CGSize(width: 400, height: 400)) Generate pdf data containing the qr code Let image = doc.uiImage(CGSize(width: 400, height: 400), scale: 3) Generate an image using the default styling (square, black foreground, white background) with 3x resolution Let path = doc.path(CGSize(width: 400, height: 400)) Generate a CGPath object containing the QR code You can further style the qr code (see below) tl dr Simple Example let doc = QRCode.Document()ĭoc.design.backgroundColor(CGColor.clear) Let generated = doc.cgImage(CGSize(width: 800, height: 800)) let doc = QRCode.Document(utf8String: "Hi there!", errorCorrection. You can create a basic black-and-white QR code image very easily. And if you're using Swift you can retrieve the raw qr code data as a 2D array of Bool to use however you need. You can use this class to generate a QR Code and present the result as a CGPath or a CGImage. It is not tied to any presentation medium and is cross-platform across Apple OSes. The QRCode.Document class is the core class you will interact with. Command line tool for generating qr codes from the command line (macOS 10.13+).Configurable fill styles (solid, linear gradient, radial gradient) for image generation. Generate images, scalable PDFs and CGPath paths.Drop-in live display support for SwiftUI, NSView (macOS) and UIView (iOS/tvOS).Generate a QR code without access to a UI.This also contains a command-line application for generating a qrcode from the command line ( qrcodegen). It's nice to have a simple, quick drop-in component for displaying a QR code when you need one :-). A simple and quick macOS/iOS/tvOS/watchOS QR Code generator/detector library for SwiftUI, Swift and Objective-C.
0 Comments
Leave a Reply. |