5 Commits

Author SHA1 Message Date
Haik Aslanyan 63a209fb0c Update README.md 2020-06-23 21:41:58 +04:00
Haik Aslanyan 2fa33d0e88 updated readme 2020-05-09 13:30:36 +04:00
Haik Aslanyan 25d734d87d updated readme file 2020-05-07 21:19:32 +04:00
Haik Aslanyan a95fc1265c Merge pull request #7 from aslanyanhaik/develop
Develop
2020-05-07 21:11:29 +04:00
Haik Aslanyan 118dcd6752 Merge pull request #6 from aslanyanhaik/develop
Develop
2020-05-07 14:46:09 +04:00
2 changed files with 15 additions and 14 deletions
+12 -10
View File
@@ -5,10 +5,8 @@
[![Twitter: @aslanyanhaik](https://img.shields.io/badge/Contact-Twitter-blue.svg?style=flat)](https://twitter.com/aslanyanhaik) [![Twitter: @aslanyanhaik](https://img.shields.io/badge/Contact-Twitter-blue.svg?style=flat)](https://twitter.com/aslanyanhaik)
RoundCode is custom circular QR code with lots of customization.
RoundCode is a Facebook messenger like custom QR code with lots of customization. Similar to Facebook messenger and Apple's App Clip Codes the RoundCode includes convenient camera scanner and decoder.
In addition to encoder the RoundCode also includes convenient camera scanner and decoder.
<h3 align="center"> <h3 align="center">
<img src="appearance.png" alt="Different styles of RoundCode for iOS"/> <img src="appearance.png" alt="Different styles of RoundCode for iOS"/>
@@ -81,14 +79,14 @@ You can also decode a UIImage like this
```swift ```swift
let coder = RCCoder() let coder = RCCoder()
do { do {
messageLabel.text = try coder.decode(UIImage(named: code)!) messageLabel.text = try coder.decode(UIImage(named: code)!)
} catch { } catch {
//handle errors //handle errors
} }
``` ```
### Appearance ## Appearance
You can change the appearance like this You can change the appearance like this
@@ -100,10 +98,14 @@ image.size = 300
image.gradientType = .linear(angle: CGFloat.pi) image.gradientType = .linear(angle: CGFloat.pi)
image.tintColors = [.red, .black] image.tintColors = [.red, .black]
``` ```
If image is on dark background you should change scanning mode to `darkBackground`
⚠️ When choosing colors or transparent background you should keep in mind that decoder will detect the code on light background with dark colors ⚠️ ```swift
let coder = RCCoder()
coder.scanningMode = .darkBackground
```
### Advanced ## Advanced coding configuration
You can provide custom coding configuration in order to encode long text by reducing number of characters You can provide custom coding configuration in order to encode long text by reducing number of characters
+1 -2
View File
@@ -74,9 +74,8 @@ extension RCImageDecoder {
return points return points
} }
private func scanPixelPattern(for mode: ScanMode, data: PixelContainer) -> [PixelPattern] { private func scanPixelPattern(for mode: ScanMode, data: PixelContainer) -> [PixelPattern] {
var lastPattern = PixelPattern.init(bit: pixelThreshold.contains((data[0, 0])) ? RCBit.one : RCBit.zero, x: 0, y: 0, count: 0) var lastPattern = PixelPattern(bit: pixelThreshold.contains((data[0, 0])) ? RCBit.one : RCBit.zero, x: 0, y: 0, count: 0)
var pixelPatterns = [lastPattern] var pixelPatterns = [lastPattern]
var count = 0 var count = 0
let maxSize = size * size let maxSize = size * size