RoundCode is custom circular QR code with lots of customization.
Similar to Facebook messenger and Apple’s App Clip Codes the RoundCode includes convenient camera scanner and decoder.
Installation
Cocoapods:
pod 'RoundCode'
Swift Package Manager:
File > Swift Packages > Add Package Dependency
https://github.com/aslanyanhaik/RoundCode
Usage example
import framework
import RoundCode
Encoding
create coder and encode
let image = RCImage(message: "Hello World")
let coder = RCCoder()
do {
imageView.image = try coder.encode(image)
} catch {
//handle errors
}
You can also validate the messsage before encoding
let coder = RCCoder()
let isValidText = coder.validate("Hello world")
Decoding
Create instane of RCCameraViewController and handle the delegate
If image is on dark background you should change scanning mode to darkBackground
let coder = RCCoder()
coder.scanningMode = .darkBackground
Advanced coding configuration
You can provide custom coding configuration in order to encode long text by reducing number of characters
let configuration = RCCoderConfiguration.shortConfiguration
let coder = RCCoder(configuration: configuration)
let configuration = RCCoderConfiguration(characters: " -abcdefghijklmnopqrstuvwxyz0123456789")
let coder = RCCoder(configuration: configuration)
⚠️ If you are encoding with custom configuration, then you should change the RCCameraViewController configuration ⚠️
let configuration = RCCoderConfiguration(characters: " -abcdefghijklmnopqrstuvwxyz0123456789")
let coder = RCCoder(configuration: configuration)
let camera = RCCameraViewController()
camera.coder = coder
RoundCode for iOS
RoundCode is custom circular QR code with lots of customization. Similar to Facebook messenger and Apple’s App Clip Codes the RoundCode includes convenient camera scanner and decoder.
Installation
Cocoapods:
Swift Package Manager:
File > Swift Packages > Add Package Dependency
Usage example
import framework
Encoding
create coder and encode
You can also validate the messsage before encoding
Decoding
Create instane of RCCameraViewController and handle the delegate
You can also decode a UIImage like this
Appearance
You can change the appearance like this
If image is on dark background you should change scanning mode to
darkBackground
Advanced coding configuration
You can provide custom coding configuration in order to encode long text by reducing number of characters
⚠️ If you are encoding with custom configuration, then you should change the RCCameraViewController configuration ⚠️
Compatibility
Written in Swift 5 and requires Xcode 11.0
RoundCode is compatible with iOS 13.0+.
Author
License
Copyright 2020 Haik Aslanyan.
Licensed under MIT License: https://opensource.org/licenses/MIT