https://github.com/fwcd/swift-qrcode-generator
QR code generator written in pure Swift
https://github.com/fwcd/swift-qrcode-generator
linux qrcode qrcode-generator swift
Last synced: 12 months ago
JSON representation
QR code generator written in pure Swift
- Host: GitHub
- URL: https://github.com/fwcd/swift-qrcode-generator
- Owner: fwcd
- License: mit
- Created: 2020-02-25T17:17:17.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2023-11-20T01:17:08.000Z (over 2 years ago)
- Last Synced: 2025-04-27T13:51:57.674Z (12 months ago)
- Topics: linux, qrcode, qrcode-generator, swift
- Language: Swift
- Size: 81.1 KB
- Stars: 47
- Watchers: 1
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Swift QR Code Generator
[](https://github.com/fwcd/swift-qrcode-generator/actions/workflows/linux.yml)
[](https://github.com/fwcd/swift-qrcode-generator/actions/workflows/darwin.yml)
A QR code generator written in pure Swift with no dependencies.
The project is mostly a direct translation of [Nayuki's](https://github.com/nayuki/) [QR code generator for Rust](https://github.com/nayuki/QR-Code-generator/tree/master/rust), with small changes applied to make the code more idiomatic in Swift.
## Usage
### Swift Package Manager
To use in your project, add the following dependency to your `Package.swift`:
```swift
.package(url: "https://github.com/fwcd/swift-qrcode-generator.git", from: "1.0.0")
```
### CocoaPods
Swift QR Code Generator is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```bash
pod 'SwiftQRCodeGenerator'
```
## Example
```swift
import QRCodeGenerator
let qr = try! QRCode.encode(text: text, ecl: .medium)
let svg = qr.toSVGString(border: 4)
```