aslanyanhaik/RoundCode
소개
다양한 옵션으로 사용자 지정할 수 있는 둥근 모서리 QR 코드입니다.
기타 프로젝트측정된 스타 증가
- in 24h
- +1
- in 7 days
- +1
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalRoundCode 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:
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
class ViewController: UIViewController, RCCameraViewControllerDelegate {
func scan() {
let cameraController = RCCameraViewController()
cameraController.delegate = self
present(cameraController, animated: true)
}
func cameraViewController(didFinishScanning message: String) {
messageLabel.text = message
}
}
You can also decode a UIImage like this
let coder = RCCoder()
do {
messageLabel.text = try coder.decode(UIImage(named: code)!)
} catch {
//handle errors
}
Appearance
You can change the appearance like this
var image = RCImage(message: "Hello world")
image.contentInsets = UIEdgeInsets(top: 8, left: 10, bottom: 4, right: 10)
image.attachmentImage = UIImage(named: "Profile")
image.size = 300
image.gradientType = .linear(angle: CGFloat.pi)
image.tintColors = [.red, .black]
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
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
관련 프로젝트 살펴보기
불러오는 중…