/libqrencode-swift

The libqrencode-swift is tiny Swift library for quick and simple generating QR codes. Especially to Server Side Swift.

Primary LanguageCMIT LicenseMIT

libqrencode-swift

Swift 5.2+ Xcode 11.0+ Swift Package License

The libqrencode-swift is tiny Swift library for quick and simple generating QR codes. The main goal of creating this wrapper is using lib on the server side. If you backed form iOS or MacOS developing, you probably know that QR code generation is trivial. Unfortunately, we can't using powerful Core Graphics frameworks on server side in Swift. So if you move on to server side code, that way is not applicable.

Swift Package

Install

To integrate library into your code, use SPM

...
dependencies: [
.package(path: "https://github.com/digital-horizon/libqrencode-swift")
]
...

The library works well in Mac OS and Linux – anywhere the Swift toolchain is available.

Using

let str = "https://apple.com"
let colors:[Int] = [120,200,45] // you can optionally set color via components (or pass nil to black by default)

let result = QREncodeSwift.qr(from: str, level: .middle, outputFileName: "qr.png", colorComponents:nil)

if result == true {
    // check qr.png file here
}

And viola!

QR

License

The libqrencode-swfit is released under the MIT License.