You are on page 1of 8

Generate QRCode: List of possible Library!!

1. “CIQRCodeGenerator” filter from Core Image


+ native library from apple
+ support parameter errorCorrectionLevel
+ easy to use
- just generate standar QR code. will problematic when QR Code design is complex

https://developer.apple.com/library/content/documentation/GraphicsImaging/Reference/
CoreImageFilterReference/index.html#//apple_ref/doc/filter/ci/CIQRCodeGenerator

2. EFQRCode from EyreFree


+ support swift 4
+ can generate GIF QRCode
+ cross platform
+ support QR code recognition
- big size module

https://github.com/EyreFree/EFQRCode

3. QRCode from aschuch


+ easy to use
+ simple library
- not support swift 4

https://github.com/aschuch/QRCode

4. iOS-QR-Code-Generator from gscarrone


+ simple library
- objective-c
- not maintained for long time

https://github.com/gscarrone/iOS-QR-Code-Generator

Note:
I think I will start testing with option 1.
If possible, I prefer to not adding library to keep at minimum app size.
TESTING with “CIQRCodeGenerator” filter

Total character of input


There are 3 proposed input:

1. user ID as input. => [1-8] characters


I tried to register new user and got userId = 10072546 (member since 11-1-2018). So I
assume max user ID for now is 8 characters.
2. Short url: “​https://kask.us/u/​<userId>” => [19-26] characters.
“​https://kask.us/u/​” has total 18 characters. So 18 + [1-8] = [19-26] characters.
3. Long url: “​https://www.kaskus.co.id/profile/​<userId>” => [34-41] characters.
“​https://www.kaskus.co.id/profile/​” has total 33 characters. So 33 + [1-8] = [34-41]
characters.

Table QR Code version

Please take a look at Table QR Code Version.


Most of QR Code library will automatically adjust which version is used based on total character
input. So here I made a comparison table based on 3 proposed input.
Comparison Table based on Proposed Input
total character error correction QR code size
input level (modules) version
L 21x21 1
M 21x21 1
1 - 8 characters
Q 21x21 1
H 21x21 1
L 21x21, 25x25 1,2
M 21x21, 25x25 1,2
19 - 26 characters
Q 25x25 2
H 25x25, 29x29 2,3
L 25x25 2
M 25x25, 29x29 2,3
34 - 41 characters
Q 29x29 3
H 29x29, 33x33 3,4

The module refers to the black and white dots that make up QR Code. ​Each QR Code symbol
version has the maximum data capacity according to the amount of data, character type and error
correction level. In other words, as the amount of data increases, more modules are required to
comprise QR Code, resulting in larger QR Code symbols.

Here is sample of generated QR Code that has different modules size


This modules information is important to determine the size of masking view
When the size of masking view is too big so that it cover area more than error correction
capability, it will make QR code can not be read/scanned.

From this we can do a calculation, for example:

Example 1
Input = “​https://kask.us/u/12345​” => total characters = 23
Error correction level = Q ~> Approx 25%
Circle diameter = 11 modules
Square width = 5 modules
Based on table will be generated QR code size = 25x25 modules
Total covered area % = (11*11 + 5*5 )/ (25*25) * 100% = ​23.36%
Conclusion: ​23.36% ~> ​still below 25%, so it should ​can be read/scanned.
Result:​ SUCCESS
Example 2
Input = “​https://kask.us/u/12345​” => total characters = 23
Error correction level = Q ~> Approx 25%
Circle diameter = 11 modules
Square width = ​6 modules (​previous example is using 5 modules​)
Based on table will be generated QR code size = 25x25 modules
Total covered area % = (11*11 + 6*6) / (25*25) * 100% = ​25.12%
Conclusion:​ 25.12% ~> ​more than 25%, so it can’t be read/scanned.
Result:​ FAILURE

For time to generate, here is full report (tested on Device iPhone SE iOS 10.3.3)

total error time to generate


input character correction (ms)
L 1
M 2
"3" 1
Q 2
H 2
L 1
M 2
"67" 2
Q 2
H 2
"456" 3 L 2
M 2
Q 2
H 2
L 2
M 3
"9876" 4
Q 2
H 2
L 3
M 2
"12345" 5
Q 3
H 3
L 3
M 2
"232323" 6
Q 2
H 3
L 3
M 3
"7777777" 7
Q 3
H 3
L 3
M 3
"12345678" 8
Q 3
H 3
L 3
M 2
"https://kask.us/u/3" 19
Q 3
H 3
L 2
M 3
"https://kask.us/u/67" 20
Q 3
H 3
L 3
M 4
"https://kask.us/u/456" 21
Q 3
H 4
L 4
M 4
"https://kask.us/u/9876" 22
Q 4
H 3
L 4
M 5
"https://kask.us/u/12345" 23
Q 5
H 5
L 5
M 5
"https://kask.us/u/232323" 24
Q 4
H 5
L 5
M 5
"https://kask.us/u/7777777" 25
Q 5
H 5
L 5
M 5
"https://kask.us/u/12345678" 26
Q 3
H 4
L 5
M 4
"https://www.kaskus.co.id/profile/3" 34
Q 4
H 4
L 4
M 4
"https://www.kaskus.co.id/profile/67" 35
Q 4
H 5
L 4
M 3
"https://www.kaskus.co.id/profile/456" 36
Q 4
H 4
L 4
"https://www.kaskus.co.id/profile/9876" 37
M 3
Q 5
H 5
L 2
M 4
"https://www.kaskus.co.id/profile/12345" 38
Q 5
H 5
L 4
M 5
"https://www.kaskus.co.id/profile/232323" 39
Q 5
H 6
L 5
M 5
"https://www.kaskus.co.id/profile/7777777" 40
Q 5
H 6
L 6

"https://www.kaskus.co.id/profile/1234567 M 7
41
8" Q 8
H 8

You might also like