This project intends to be a small wrapper around C++ code from https://github.com/nayuki/QR-Code-generator in order to be able to use it with Swift easily.
git clone git@github.com:fjfdeztoro/Swift-QR-Code-generator.git
cd Swift-QR-Code-generator/
swift build && swift test
All the steps from previous entry and:
swift package generate-xcodeproj
open QRCodeGenerator.xcodeproj/
Select target: QRCodeGenerator-Package
Go to Build Settings for the project.
Select All
Look for Apple LLVM - Language - C++ section
Change C++ Language Dialect to C++11[-std=c++11]
Change C++ Standard Library to libc++
cmd+b
In your Package.swift
add this entry as a new dependency:
.package(url: "https://github.com/fjfdeztoro/Swift-QR-Code-generator.git", from: "0.0.2")
And in your target, add this dependency: "QRCodeGenerator"
import QRCodeGenerator
print(QRCodeGenerator.getQRCodeAsSVG("https://github.com/fjfdeztoro/Swift-QR-Code-generator/blob/master/README.md", withTolerance: .High))
That code will print the content of a SVG file that will contain a QR with a URL to this file.
Copyright © Project Nayuki
Copyright © Fran Fernández
MIT License.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
The Software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software.