Manos Chorianopoulos

add barcode lib

Showing 44 changed files with 1831 additions and 4 deletions
No preview for this file type
...@@ -6,5 +6,6 @@ target 'WarplySDKFrameworkIOS' do ...@@ -6,5 +6,6 @@ target 'WarplySDKFrameworkIOS' do
6 use_frameworks! 6 use_frameworks!
7 7
8 # Pods for WarplySDKFrameworkIOS 8 # Pods for WarplySDKFrameworkIOS
9 + pod 'RSBarcodes_Swift', '~> 5.1.1'
9 10
10 end 11 end
......
1 -PODFILE CHECKSUM: 469e9ad6db6643e917950516ae5b80abb382aab0 1 +PODS:
2 + - RSBarcodes_Swift (5.1.1)
3 +
4 +DEPENDENCIES:
5 + - RSBarcodes_Swift (~> 5.1.1)
6 +
7 +SPEC REPOS:
8 + trunk:
9 + - RSBarcodes_Swift
10 +
11 +SPEC CHECKSUMS:
12 + RSBarcodes_Swift: 9be8dd1d00b9ac12e72f3d853cacb680c7722c9f
13 +
14 +PODFILE CHECKSUM: be58eb83ead1cb6b1899b4f27c75472329a24d7f
2 15
3 COCOAPODS: 1.11.2 16 COCOAPODS: 1.11.2
......
1 -PODFILE CHECKSUM: 469e9ad6db6643e917950516ae5b80abb382aab0 1 +PODS:
2 + - RSBarcodes_Swift (5.1.1)
3 +
4 +DEPENDENCIES:
5 + - RSBarcodes_Swift (~> 5.1.1)
6 +
7 +SPEC REPOS:
8 + trunk:
9 + - RSBarcodes_Swift
10 +
11 +SPEC CHECKSUMS:
12 + RSBarcodes_Swift: 9be8dd1d00b9ac12e72f3d853cacb680c7722c9f
13 +
14 +PODFILE CHECKSUM: be58eb83ead1cb6b1899b4f27c75472329a24d7f
2 15
3 COCOAPODS: 1.11.2 16 COCOAPODS: 1.11.2
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<Scheme
3 + LastUpgradeVersion = "1240"
4 + version = "1.3">
5 + <BuildAction
6 + parallelizeBuildables = "YES"
7 + buildImplicitDependencies = "YES">
8 + <BuildActionEntries>
9 + <BuildActionEntry
10 + buildForTesting = "YES"
11 + buildForRunning = "YES"
12 + buildForProfiling = "YES"
13 + buildForArchiving = "YES"
14 + buildForAnalyzing = "YES">
15 + <BuildableReference
16 + BuildableIdentifier = "primary"
17 + BlueprintIdentifier = "C6C64B3B320397CC1D8287CA8BA24255"
18 + BuildableName = "Pods_WarplySDKFrameworkIOS.framework"
19 + BlueprintName = "Pods-WarplySDKFrameworkIOS"
20 + ReferencedContainer = "container:Pods.xcodeproj">
21 + </BuildableReference>
22 + </BuildActionEntry>
23 + </BuildActionEntries>
24 + </BuildAction>
25 + <TestAction
26 + buildConfiguration = "Debug"
27 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29 + shouldUseLaunchSchemeArgsEnv = "YES">
30 + <Testables>
31 + </Testables>
32 + </TestAction>
33 + <LaunchAction
34 + buildConfiguration = "Debug"
35 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37 + launchStyle = "0"
38 + useCustomWorkingDirectory = "NO"
39 + ignoresPersistentStateOnLaunch = "NO"
40 + debugDocumentVersioning = "YES"
41 + debugServiceExtension = "internal"
42 + allowLocationSimulation = "YES">
43 + </LaunchAction>
44 + <ProfileAction
45 + buildConfiguration = "Release"
46 + shouldUseLaunchSchemeArgsEnv = "YES"
47 + savedToolIdentifier = ""
48 + useCustomWorkingDirectory = "NO"
49 + debugDocumentVersioning = "YES">
50 + </ProfileAction>
51 + <AnalyzeAction
52 + buildConfiguration = "Debug">
53 + </AnalyzeAction>
54 + <ArchiveAction
55 + buildConfiguration = "Release"
56 + revealArchiveInOrganizer = "YES">
57 + </ArchiveAction>
58 +</Scheme>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<Scheme
3 + LastUpgradeVersion = "1240"
4 + version = "1.3">
5 + <BuildAction
6 + parallelizeBuildables = "YES"
7 + buildImplicitDependencies = "YES">
8 + <BuildActionEntries>
9 + <BuildActionEntry
10 + buildForTesting = "YES"
11 + buildForRunning = "YES"
12 + buildForProfiling = "YES"
13 + buildForArchiving = "YES"
14 + buildForAnalyzing = "YES">
15 + <BuildableReference
16 + BuildableIdentifier = "primary"
17 + BlueprintIdentifier = "3C896FA0C00DEA19240C4BFD2C54E0D3"
18 + BuildableName = "RSBarcodes_Swift.framework"
19 + BlueprintName = "RSBarcodes_Swift"
20 + ReferencedContainer = "container:Pods.xcodeproj">
21 + </BuildableReference>
22 + </BuildActionEntry>
23 + </BuildActionEntries>
24 + </BuildAction>
25 + <TestAction
26 + buildConfiguration = "Debug"
27 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29 + shouldUseLaunchSchemeArgsEnv = "YES">
30 + <Testables>
31 + </Testables>
32 + </TestAction>
33 + <LaunchAction
34 + buildConfiguration = "Debug"
35 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37 + launchStyle = "0"
38 + useCustomWorkingDirectory = "NO"
39 + ignoresPersistentStateOnLaunch = "NO"
40 + debugDocumentVersioning = "YES"
41 + debugServiceExtension = "internal"
42 + allowLocationSimulation = "YES">
43 + </LaunchAction>
44 + <ProfileAction
45 + buildConfiguration = "Release"
46 + shouldUseLaunchSchemeArgsEnv = "YES"
47 + savedToolIdentifier = ""
48 + useCustomWorkingDirectory = "NO"
49 + debugDocumentVersioning = "YES">
50 + </ProfileAction>
51 + <AnalyzeAction
52 + buildConfiguration = "Debug">
53 + </AnalyzeAction>
54 + <ArchiveAction
55 + buildConfiguration = "Release"
56 + revealArchiveInOrganizer = "YES">
57 + </ArchiveAction>
58 +</Scheme>
...@@ -4,11 +4,22 @@ ...@@ -4,11 +4,22 @@
4 <dict> 4 <dict>
5 <key>SchemeUserState</key> 5 <key>SchemeUserState</key>
6 <dict> 6 <dict>
7 - <key>Pods-WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key> 7 + <key>Pods-WarplySDKFrameworkIOS.xcscheme</key>
8 <dict> 8 <dict>
9 + <key>isShown</key>
10 + <false/>
9 <key>orderHint</key> 11 <key>orderHint</key>
10 <integer>0</integer> 12 <integer>0</integer>
11 </dict> 13 </dict>
14 + <key>RSBarcodes_Swift.xcscheme</key>
15 + <dict>
16 + <key>isShown</key>
17 + <false/>
18 + <key>orderHint</key>
19 + <integer>1</integer>
20 + </dict>
12 </dict> 21 </dict>
22 + <key>SuppressBuildableAutocreation</key>
23 + <dict/>
13 </dict> 24 </dict>
14 </plist> 25 </plist>
......
1 +The MIT License (MIT)
2 +
3 +Copyright (c) 2012-2014 P.D.Q.
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy of
6 +this software and associated documentation files (the "Software"), to deal in
7 +the Software without restriction, including without limitation the rights to
8 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 +the Software, and to permit persons to whom the Software is furnished to do so,
10 +subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in all
13 +copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 +<p align="center">
2 + <img src="https://raw.githubusercontent.com/yeahdongcn/RSBarcodes_Swift/master/home-hero-swift-hero.png">
3 +</p>
4 +
5 +RSBarcodes, now in Swift.
6 +
7 +[![Build Status](https://travis-ci.org/yeahdongcn/RSBarcodes_Swift.svg?branch=master)](https://travis-ci.org/yeahdongcn/RSBarcodes_Swift) [![codecov.io](https://codecov.io/gh/yeahdongcn/RSBarcodes_Swift/branch/master/graphs/badge.svg)](https://codecov.io/gh/yeahdongcn/RSBarcodes_Swift/branch/master) ![](https://img.shields.io/badge/Swift-5.0-blue.svg?style=flat) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) ![](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)
8 +
9 +---
10 +
11 +RSBarcodes allows you to read 1D and 2D barcodes using the metadata scanning capabilities introduced with iOS 7 and generate the same set of barcode images for displaying and sharing. Now implemented in Swift.
12 +
13 +- Objective-C version: [RSBarcodes](https://github.com/yeahdongcn/RSBarcodes)
14 +
15 +## TODO
16 +
17 +### Generators
18 +
19 +- [x] Code39
20 +- [x] Code39Mod43
21 +- [x] ExtendedCode39
22 +- [x] Code93
23 +- [x] Code128
24 +- [x] UPCE
25 +- [x] EAN FAMILIY (EAN8 EAN13 ISBN13 ISSN13)
26 +- [x] ITF14
27 +- [x] Interleaved2of5
28 +- [ ] DataMatrix
29 +- [x] PDF417
30 +- [x] QR
31 +- [x] Aztec
32 +- [x] Views
33 +
34 +### Reader
35 +
36 +- [x] Views
37 +- [x] ReaderController
38 +
39 +## Installation
40 +
41 +### [Swift Package Manager](https://github.com/apple/swift-package-manager)
42 +
43 +To add a package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enter https://github.com/yeahdongcn/RSBarcodes_Swift to the text field.
44 +
45 +
46 +### [CocoaPods](http://cocoapods.org)
47 +
48 +Simply add the following lines to your `Podfile`:
49 +
50 +```ruby
51 +# required by Cocoapods 0.36.0.rc.1 for Swift Pods
52 +use_frameworks!
53 +
54 +pod 'RSBarcodes_Swift', '~> 5.1.1'
55 +```
56 +
57 +You will need to import RSBarcodes_Swift manually in the ViewController file after creating the file using wizard.
58 +
59 +*(CocoaPods v0.36 or later required. See [this blog post](http://blog.cocoapods.org/Pod-Authors-Guide-to-CocoaPods-Frameworks/) for details.)*
60 +
61 +### [Carthage](http://github.com/Carthage/Carthage)
62 +
63 +Simply add the following line to your `Cartfile`:
64 +
65 +```ruby
66 +github "yeahdongcn/RSBarcodes_Swift" >= 5.1.1
67 +```
68 +
69 +You will need to import RSBarcodes_Swift manually in the ViewController file after creating the file using wizard.
70 +
71 +### Swift Package Manager (required Xcode 11)
72 +
73 +1. Select File > Swift Packages > Add Package Dependency. Enter `https://github.com/yeahdongcn/RSBarcodes_Swift` in the "Choose Package Repository" dialog.
74 +2. In the next page, specify the version resolving rule as "Up to Next Major" with the latest version.
75 +3. After Xcode checking out the source and resolving the version, you can choose the "RSBarcodes_Swift" library and add it to your app target.
76 +
77 +### Manual
78 +
79 +1. Add RSBarcodes_Swift as a [submodule](http://git-scm.com/docs/git-submodule) by opening the Terminal, `cd`-ing into your top-level project directory, and entering the command `git submodule add https://github.com/yeahdongcn/RSBarcodes_Swift.git`
80 +2. Open the `RSBarcodes_Swift` folder, and drag `RSBarcodes.xcodeproj` into the file navigator of your app project.
81 +3. In Xcode, navigate to the target configuration window by clicking on the blue project icon, and select the application target under the "Targets" heading in the sidebar.
82 +4. Ensure that the deployment target of RSBarcodes.framework matches that of the application target.
83 +5. In the tab bar at the top of that window, open the "Build Phases" panel.
84 +6. Expand the "Target Dependencies" group, and add `RSBarcodes.framework`.
85 +7. Click on the `+` button at the top left of the panel and select "New Copy Files Phase". Rename this new phase to "Copy Frameworks", set the "Destination" to "Frameworks", and add `RSBarcodes.framework`.
86 +8. Need to import RSBarcodes manually in the ViewController file after creating the file using wizard.
87 +
88 +## Usage
89 +
90 +[How to Use Generator](#generator-1) and
91 +[How to Use Reader](#reader-1)
92 +
93 +### Generators
94 +
95 +First, import the following frameworks:
96 +
97 +``` swift
98 +import RSBarcodes_Swift
99 +import AVFoundation
100 +```
101 +
102 +Then, use the generator to generate a barcode. For example:
103 +
104 +``` swift
105 +RSUnifiedCodeGenerator.shared.generateCode("2166529V", machineReadableCodeObjectType: AVMetadataObjectTypeCode39Code)
106 +```
107 +It will generate a `UIImage` instance if the `2166529V` is a valid code39 string. For `AVMetadataObjectTypeCode128Code`, you can change `useBuiltInCode128Generator` to `false` to use my implementation (AutoTable for code128).
108 +
109 +P.S. There are 4 tables for encoding a string to code128, `TableA`, `TableB`, `TableC` and `TableAuto`; the `TableAuto` is always the best choice, but if one has specific requirements, try this:
110 +
111 +``` swift
112 +RSCode128Generator(codeTable: .A).generateCode("123456", machineReadableCodeObjectType: AVMetadataObjectTypeCode128Code)
113 +```
114 +Example of these simple calls can be found in the test project.
115 +
116 +### Reader
117 +
118 +The following are steps to get the barcode reader working:
119 +
120 +1. `File` -> `New` -> `File`
121 +2. Under `iOS` click `source` and make sure `Cocoa Touch Class` is selected and hit `Next`.
122 +3. Call the name of the class whatever you want but I will refer to it as `ScanViewController` from now on.
123 +4. Make it a subclass of `RSCodeReaderViewController` and ensure the language is `Swift` and hit `Next` and then `Create`
124 +5. Open your storyboard and drag a `UIViewController` onto it.
125 +6. Show the identity inspect and under custom class select `ScanViewController`
126 +7. The focus mark layer and corners layer are already there working for you. There are two handlers: one for the single tap on the screen along with the focus mark and one detected objects handler, which all detected will come to you. Now in the `ScanViewController.swift` file add the following code into the `viewDidLoad()` or some place more suitable for you:
127 + ``` swift
128 + override func viewDidLoad() {
129 + super.viewDidLoad()
130 +
131 + self.focusMarkLayer.strokeColor = UIColor.red.cgColor
132 +
133 + self.cornersLayer.strokeColor = UIColor.yellow.cgColor
134 +
135 + self.tapHandler = { point in
136 + print(point)
137 + }
138 +
139 + self.barcodesHandler = { barcodes in
140 + for barcode in barcodes {
141 + print("Barcode found: type=" + barcode.type + " value=" + barcode.stringValue)
142 + }
143 + }
144 + }
145 + ```
146 +
147 +If you want to ignore some code types (for example, `AVMetadataObjectTypeQRCode`), add the following lines:
148 +
149 +``` swift
150 +let types = NSMutableArray(array: self.output.availableMetadataObjectTypes)
151 +types.remove(AVMetadataObjectTypeQRCode)
152 +self.output.metadataObjectTypes = NSArray(array: types)
153 +```
154 +
155 +### Validator
156 +
157 +To validate codes:
158 +
159 +``` swift
160 +let isValid = RSUnifiedCodeValidator.shared.isValid(code, machineReadableCodeObjectType: AVMetadataObjectTypeEAN13Code)
161 +```
162 +
163 +### Image helpers
164 +
165 +Use `RSAbstractCodeGenerator.resizeImage(source: UIImage, scale: CGFloat)` to scale the generated image.
166 +
167 +Use `RSAbstractCodeGenerator.resizeImage(source: UIImage, targetSize: CGSize, contentMode: UIViewContentMode)` to fill/fit the bounds of something to the best capability and don't necessarily know what scale is too much to fill/fit, or if the `UIImageView` itself is flexible.
168 +
169 +## Miscellaneous
170 +
171 +[The Swift Programming Language 中文版](https://github.com/numbbbbb/the-swift-programming-language-in-chinese/)
172 +
173 +[Online version](http://numbbbbb.github.io/the-swift-programming-language-in-chinese/) generated using [GitBook](https://www.gitbook.io/)
174 +
175 +## License
176 +
177 + The MIT License (MIT)
178 +
179 + Copyright (c) 2012-2014 P.D.Q.
180 +
181 + Permission is hereby granted, free of charge, to any person obtaining a copy of
182 + this software and associated documentation files (the "Software"), to deal in
183 + the Software without restriction, including without limitation the rights to
184 + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
185 + the Software, and to permit persons to whom the Software is furnished to do so,
186 + subject to the following conditions:
187 +
188 + The above copyright notice and this permission notice shall be included in all
189 + copies or substantial portions of the Software.
190 +
191 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
192 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
193 + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
194 + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
195 + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
196 + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 +//
2 +// ContextMaker.swift
3 +// RSBarcodes
4 +//
5 +// Created by Alexey Korolev on 11.10.2019.
6 +// Copyright © 2019 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +
11 +final class ContextMaker {
12 + static func make() -> CIContext {
13 + return CIContext(options: nil)
14 + }
15 +}
1 +//
2 +// RSCode39Generator.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/10/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import Foundation
10 +
11 +let CODE39_ALPHABET_STRING = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*"
12 +
13 +// http://www.barcodesymbols.com/code39.htm
14 +// http://www.barcodeisland.com/code39.phtml
15 +open class RSCode39Generator: RSAbstractCodeGenerator {
16 + let CODE39_CHARACTER_ENCODINGS = [
17 + "1010011011010",
18 + "1101001010110",
19 + "1011001010110",
20 + "1101100101010",
21 + "1010011010110",
22 + "1101001101010",
23 + "1011001101010",
24 + "1010010110110",
25 + "1101001011010",
26 + "1011001011010",
27 + "1101010010110",
28 + "1011010010110",
29 + "1101101001010",
30 + "1010110010110",
31 + "1101011001010",
32 + "1011011001010",
33 + "1010100110110",
34 + "1101010011010",
35 + "1011010011010",
36 + "1010110011010",
37 + "1101010100110",
38 + "1011010100110",
39 + "1101101010010",
40 + "1010110100110",
41 + "1101011010010",
42 + "1011011010010",
43 + "1010101100110",
44 + "1101010110010",
45 + "1011010110010",
46 + "1010110110010",
47 + "1100101010110",
48 + "1001101010110",
49 + "1100110101010",
50 + "1001011010110",
51 + "1100101101010",
52 + "1001101101010",
53 + "1001010110110",
54 + "1100101011010",
55 + "1001101011010",
56 + "1001001001010",
57 + "1001001010010",
58 + "1001010010010",
59 + "1010010010010",
60 + "1001011011010"
61 + ]
62 +
63 + func encodeCharacterString(_ characterString:String) -> String {
64 + let location = CODE39_ALPHABET_STRING.location(characterString)
65 + return CODE39_CHARACTER_ENCODINGS[location]
66 + }
67 +
68 + // MAKR: RSAbstractCodeGenerator
69 +
70 + override open func isValid(_ contents: String) -> Bool {
71 + if contents.length() > 0
72 + && contents.range(of: "*") == nil
73 + && contents == contents.uppercased() {
74 + for character in contents {
75 + let location = CODE39_ALPHABET_STRING.location(String(character))
76 + if location == NSNotFound {
77 + return false
78 + }
79 + }
80 + return true
81 + }
82 + return false
83 + }
84 +
85 + override open func initiator() -> String {
86 + return self.encodeCharacterString("*")
87 + }
88 +
89 + override open func terminator() -> String {
90 + return self.encodeCharacterString("*")
91 + }
92 +
93 + override open func barcode(_ contents: String) -> String {
94 + var barcode = ""
95 + for character in contents {
96 + barcode += self.encodeCharacterString(String(character))
97 + }
98 + return barcode
99 + }
100 +}
1 +//
2 +// RSCode39Mod43Generator.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/10/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +
11 +// http://www.barcodesymbols.com/code39.htm
12 +// http://www.barcodeisland.com/code39.phtml
13 +open class RSCode39Mod43Generator: RSCode39Generator, RSCheckDigitGenerator {
14 +
15 + // MARK: RSAbstractCodeGenerator
16 +
17 + override open func barcode(_ contents: String) -> String {
18 + return super.barcode(contents + self.checkDigit(contents.uppercased()))
19 + }
20 +
21 + // MARK: RSCheckDigitGenerator
22 +
23 + open func checkDigit(_ contents: String) -> String {
24 + /**
25 + Step 1: From the table below, find the values of each character.
26 + C O D E 3 9 <--Message characters
27 + 12 24 13 14 38 3 9 <--Character values
28 +
29 + Step 2: Sum the character values.
30 + 12 + 24 + 13 + 14 + 38 + 3 + 9 = 113
31 +
32 + Step 3: Divide the result by 43.
33 + 113 / 43 = 11 with remainder of 27.
34 +
35 + Step 4: From the table, find the character with this value.
36 + 27 = R = Check Character
37 + */
38 + var sum = 0
39 + for character in contents {
40 + sum += CODE39_ALPHABET_STRING.location(String(character))
41 + }
42 + // 43 = CODE39_ALPHABET_STRING's length - 1 -- excludes asterisk
43 + return CODE39_ALPHABET_STRING[sum % (CODE39_ALPHABET_STRING.length() - 1)]
44 + }
45 +}
1 +//
2 +// RSCode93Generator.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/11/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +
11 +// http://www.barcodeisland.com/code93.phtml
12 +open class RSCode93Generator: RSAbstractCodeGenerator, RSCheckDigitGenerator {
13 + let CODE93_ALPHABET_STRING = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*"
14 +
15 + let CODE93_PLACEHOLDER_STRING = "abcd";
16 +
17 + let CODE93_CHARACTER_ENCODINGS = [
18 + "100010100",
19 + "101001000",
20 + "101000100",
21 + "101000010",
22 + "100101000",
23 + "100100100",
24 + "100100010",
25 + "101010000",
26 + "100010010",
27 + "100001010",
28 + "110101000",
29 + "110100100",
30 + "110100010",
31 + "110010100",
32 + "110010010",
33 + "110001010",
34 + "101101000",
35 + "101100100",
36 + "101100010",
37 + "100110100",
38 + "100011010",
39 + "101011000",
40 + "101001100",
41 + "101000110",
42 + "100101100",
43 + "100010110",
44 + "110110100",
45 + "110110010",
46 + "110101100",
47 + "110100110",
48 + "110010110",
49 + "110011010",
50 + "101101100",
51 + "101100110",
52 + "100110110",
53 + "100111010",
54 + "100101110",
55 + "111010100",
56 + "111010010",
57 + "111001010",
58 + "101101110",
59 + "101110110",
60 + "110101110",
61 + "100100110",
62 + "111011010",
63 + "111010110",
64 + "100110010",
65 + "101011110"
66 + ]
67 +
68 +
69 + func encodeCharacterString(_ characterString:String) -> String {
70 + return CODE93_CHARACTER_ENCODINGS[CODE93_ALPHABET_STRING.location(characterString)]
71 + }
72 +
73 + override open func isValid(_ contents: String) -> Bool {
74 + if contents.length() > 0 && contents == contents.uppercased() {
75 + for i in 0..<contents.length() {
76 + if CODE93_ALPHABET_STRING.location(contents[i]) == NSNotFound {
77 + return false
78 + }
79 + if CODE93_PLACEHOLDER_STRING.location(contents[i]) != NSNotFound {
80 + return false
81 + }
82 + }
83 + return true
84 + }
85 + return false
86 + }
87 +
88 + override open func initiator() -> String {
89 + return self.encodeCharacterString("*")
90 + }
91 +
92 + override open func terminator() -> String {
93 + // With the termination bar: 1
94 + return self.encodeCharacterString("*") + "1"
95 + }
96 +
97 + override open func barcode(_ contents: String) -> String {
98 + var barcode = ""
99 + for character in contents {
100 + barcode += self.encodeCharacterString(String(character))
101 + }
102 +
103 + let checkDigits = self.checkDigit(contents)
104 + for character in checkDigits {
105 + barcode += self.encodeCharacterString(String(character))
106 + }
107 + return barcode
108 + }
109 +
110 + // MARK: RSCheckDigitGenerator
111 +
112 + open func checkDigit(_ contents: String) -> String {
113 + // Weighted sum += value * weight
114 +
115 + // The first character
116 + var sum = 0
117 + for i in 0..<contents.length() {
118 + if let character = contents[contents.length() - i - 1] {
119 + let characterValue = CODE93_ALPHABET_STRING.location(character)
120 + sum += characterValue * (i % 20 + 1)
121 + }
122 + }
123 + var checkDigits = ""
124 + checkDigits += CODE93_ALPHABET_STRING[sum % 47]
125 +
126 + // The second character
127 + sum = 0
128 + let newContents = contents + checkDigits
129 + for i in 0..<newContents.length() {
130 + if let character = newContents[newContents.length() - i - 1] {
131 + let characterValue = CODE93_ALPHABET_STRING.location(character)
132 + sum += characterValue * (i % 15 + 1)
133 + }
134 + }
135 + checkDigits += CODE93_ALPHABET_STRING[sum % 47]
136 + return checkDigits
137 + }
138 +}
1 +//
2 +// RSCodeDataMatrixGenerator.swift
3 +// RSBarcodes
4 +//
5 +// Created by R0CKSTAR on 15/10/26.
6 +// Copyright (c) 2015 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +
11 +class RSCodeDataMatrixGenerator: RSAbstractCodeGenerator {
12 +
13 +}
1 +//
2 +// RSCodeLayer.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/13/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +import QuartzCore
11 +
12 +open class RSCodeLayer: CALayer {
13 + @objc var code: UIImage?
14 +
15 + override open func draw(in ctx: CGContext) {
16 + if let code = self.code {
17 + ctx.saveGState()
18 +
19 + ctx.draw(code.cgImage!, in: self.bounds)
20 +
21 + ctx.restoreGState()
22 + }
23 + }
24 +}
1 +//
2 +// RSCornersLayer.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/13/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +import QuartzCore
11 +
12 +open class RSCornersLayer: CALayer {
13 + @objc open var strokeColor = UIColor.green.cgColor
14 + @objc open var strokeWidth: CGFloat = 2
15 + @objc open var drawingCornersArray: Array<Array<CGPoint>> = []
16 + @objc open var cornersArray: Array<[Any]> = [] {
17 + willSet {
18 + DispatchQueue.main.async(execute: {
19 + self.setNeedsDisplay()
20 + })
21 + }
22 + }
23 +
24 + override open func draw(in ctx: CGContext) {
25 + guard let cornerPointsArray = cornersArray as? [[CGPoint]] else { return }
26 +
27 + objc_sync_enter(self)
28 +
29 + ctx.saveGState()
30 +
31 + ctx.setShouldAntialias(true)
32 + ctx.setAllowsAntialiasing(true)
33 + ctx.setFillColor(UIColor.clear.cgColor)
34 + ctx.setStrokeColor(self.strokeColor)
35 + ctx.setLineWidth(self.strokeWidth)
36 +
37 + for corners in cornerPointsArray {
38 + for (idx, point) in corners.enumerated() {
39 + if idx == 0 {
40 + ctx.move(to: point)
41 + } else {
42 + ctx.addLine(to: point)
43 + }
44 + }
45 + ctx.closePath()
46 + }
47 +
48 + ctx.drawPath(using: CGPathDrawingMode.fillStroke)
49 +
50 + ctx.restoreGState()
51 +
52 + objc_sync_exit(self)
53 + }
54 +}
1 +//
2 +// RSEANGenerator.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/11/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +
11 +public let RSBarcodesTypeISBN13Code = "com.pdq.rsbarcodes.isbn13"
12 +public let RSBarcodesTypeISSN13Code = "com.pdq.rsbarcodes.issn13"
13 +
14 +// http://blog.sina.com.cn/s/blog_4015406e0100bsqk.html
15 +open class RSEANGenerator: RSAbstractCodeGenerator {
16 + var length = 0
17 + // 'O' for odd and 'E' for even
18 + let lefthandParities = [
19 + "OOOOOO",
20 + "OOEOEE",
21 + "OOEEOE",
22 + "OOEEEO",
23 + "OEOOEE",
24 + "OEEOOE",
25 + "OEEEOO",
26 + "OEOEOE",
27 + "OEOEEO",
28 + "OEEOEO"
29 + ]
30 + // 'R' for right-hand
31 + let parityEncodingTable = [
32 + ["O" : "0001101", "E" : "0100111", "R" : "1110010"],
33 + ["O" : "0011001", "E" : "0110011", "R" : "1100110"],
34 + ["O" : "0010011", "E" : "0011011", "R" : "1101100"],
35 + ["O" : "0111101", "E" : "0100001", "R" : "1000010"],
36 + ["O" : "0100011", "E" : "0011101", "R" : "1011100"],
37 + ["O" : "0110001", "E" : "0111001", "R" : "1001110"],
38 + ["O" : "0101111", "E" : "0000101", "R" : "1010000"],
39 + ["O" : "0111011", "E" : "0010001", "R" : "1000100"],
40 + ["O" : "0110111", "E" : "0001001", "R" : "1001000"],
41 + ["O" : "0001011", "E" : "0010111", "R" : "1110100"]
42 + ]
43 +
44 + init(length:Int) {
45 + self.length = length
46 + }
47 +
48 + override open func isValid(_ contents: String) -> Bool {
49 + if super.isValid(contents) && self.length == contents.length() {
50 + var sum_odd = 0
51 + var sum_even = 0
52 +
53 + for i in 0..<(self.length - 1) {
54 + let digit = Int(contents[i])!
55 + if i % 2 == (self.length == 13 ? 0 : 1) {
56 + sum_even += digit
57 + } else {
58 + sum_odd += digit
59 + }
60 + }
61 + let checkDigit = (10 - (sum_even + sum_odd * 3) % 10) % 10
62 + return Int(contents[contents.length() - 1]) == checkDigit
63 + }
64 + return false
65 + }
66 +
67 + override open func initiator() -> String {
68 + return "101"
69 + }
70 +
71 + override open func terminator() -> String {
72 + return "101"
73 + }
74 +
75 + func centerGuardPattern() -> String {
76 + return "01010"
77 + }
78 +
79 + override open func barcode(_ contents: String) -> String {
80 + var lefthandParity = "OOOO"
81 + var newContents = contents
82 + if self.length == 13 {
83 + lefthandParity = self.lefthandParities[Int(contents[0])!]
84 + newContents = contents.substring(1, length: contents.length() - 1)
85 + }
86 +
87 + var barcode = ""
88 + for i in 0..<newContents.length() {
89 + let digit = Int(newContents[i])!
90 + if i < lefthandParity.length() {
91 + barcode += self.parityEncodingTable[digit][lefthandParity[i]]!
92 + if i == lefthandParity.length() - 1 {
93 + barcode += self.centerGuardPattern()
94 + }
95 + } else {
96 + barcode += self.parityEncodingTable[digit]["R"]!
97 + }
98 + }
99 + return barcode
100 + }
101 +}
102 +
103 +class RSEAN8Generator: RSEANGenerator {
104 + init() {
105 + super.init(length: 8)
106 + }
107 +}
108 +
109 +class RSEAN13Generator: RSEANGenerator {
110 + init() {
111 + super.init(length: 13)
112 + }
113 +}
114 +
115 +class RSISBN13Generator: RSEAN13Generator {
116 + override func isValid(_ contents: String) -> Bool {
117 + // http://www.appsbarcode.com/ISBN.php
118 + return super.isValid(contents) && contents.substring(0, length: 3) == "978"
119 + }
120 +}
121 +
122 +class RSISSN13Generator: RSEAN13Generator {
123 + override func isValid(_ contents: String) -> Bool {
124 + // http://www.appsbarcode.com/ISSN.php
125 + return super.isValid(contents) && contents.substring(0, length: 3) == "977"
126 + }
127 +}
1 +//
2 +// RSExtendedCode39Generator.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/11/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +
11 +public let RSBarcodesTypeExtendedCode39Code = "com.pdq.rsbarcodes.code39.ext"
12 +
13 +// http://www.barcodesymbols.com/code39.htm
14 +// http://www.barcodeisland.com/code39.phtml
15 +open class RSExtendedCode39Generator: RSCode39Generator {
16 + func encodeContents(_ contents: String) -> String {
17 + var encodedContents = ""
18 + for character in contents {
19 + let characterString = String(character)
20 + switch characterString {
21 + case "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z":
22 + encodedContents += "+" + characterString.uppercased()
23 + case "!":
24 + encodedContents += "/A"
25 + case "\"":
26 + encodedContents += "/B"
27 + case "#":
28 + encodedContents += "/C"
29 + case "$":
30 + encodedContents += "/D"
31 + case "%":
32 + encodedContents += "/E"
33 + case "&":
34 + encodedContents += "/F"
35 + case "'":
36 + encodedContents += "/G"
37 + case "(":
38 + encodedContents += "/H"
39 + case ")":
40 + encodedContents += "/I"
41 + case "*":
42 + encodedContents += "/J"
43 + case "+":
44 + encodedContents += "/K"
45 + case ",":
46 + encodedContents += "/L"
47 + // - -> /M better to use -
48 + // . -> /N better to use .
49 + case "/":
50 + encodedContents += "/O"
51 + // 0 -> /P better to use 0
52 + // 1 -> /Q better to use 1
53 + // 2 -> /R better to use 2
54 + // 3 -> /S better to use 3
55 + // 4 -> /T better to use 4
56 + // 5 -> /U better to use 5
57 + // 6 -> /V better to use 6
58 + // 7 -> /W better to use 7
59 + // 8 -> /X better to use 8
60 + // 9 -> /Y better to use 9
61 + case ":":
62 + encodedContents += "/Z"
63 + // ESC -> %A
64 + // FS -> %B
65 + // GS -> %C
66 + // RS -> %D
67 + // US -> %E
68 + case ";":
69 + encodedContents += "%F"
70 + case "<":
71 + encodedContents += "%G"
72 + case "=":
73 + encodedContents += "%H"
74 + case ">":
75 + encodedContents += "%I"
76 + case "?":
77 + encodedContents += "%J"
78 + case "[":
79 + encodedContents += "%K"
80 + case "\\":
81 + encodedContents += "%L"
82 + case "]":
83 + encodedContents += "%M"
84 + case "^":
85 + encodedContents += "%N"
86 + case "_":
87 + encodedContents += "%O"
88 + case "{":
89 + encodedContents += "%P"
90 + case "|":
91 + encodedContents += "%Q"
92 + case "}":
93 + encodedContents += "%R"
94 + case "~":
95 + encodedContents += "%S"
96 + // DEL -> %T
97 + // NUL -> %U
98 + case "@":
99 + encodedContents += "%V"
100 + case "`":
101 + encodedContents += "%W"
102 + // SOH -> $A
103 + // STX -> $B
104 + // ETX -> $C
105 + // EOT -> $D
106 + // ENQ -> $E
107 + // ACK -> $F
108 + // BEL -> $G
109 + // BS -> $H
110 + case "\t":
111 + encodedContents += "$I"
112 + // LF -> $J
113 + // VT -> $K
114 + // FF -> $L
115 + case "\n":
116 + encodedContents += "$M"
117 + // SO -> $N
118 + // SI -> $O
119 + // DLE -> $P
120 + // DC1 -> $Q
121 + // DC2 -> $R
122 + // DC3 -> $S
123 + // DC4 -> $T
124 + // NAK -> $U
125 + // SYN -> $V
126 + // ETB -> $W
127 + // CAN -> $X
128 + // EM -> $Y
129 + // SUB -> $Z
130 + default:
131 + encodedContents += characterString
132 + }
133 + }
134 + return encodedContents
135 + }
136 +
137 + override open func isValid(_ contents: String) -> Bool {
138 + if contents.length() > 0 {
139 + let encContents = self.encodeContents(contents)
140 + for character in encContents {
141 + let location = CODE39_ALPHABET_STRING.location(String(character))
142 + if location == NSNotFound {
143 + return false
144 + }
145 + }
146 + return true
147 + }
148 + return false
149 + }
150 +
151 + override open func barcode(_ contents: String) -> String {
152 + return super.barcode(self.encodeContents(contents))
153 + }
154 +}
1 +//
2 +// RSFocusMarkLayer.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/13/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +import QuartzCore
11 +
12 +open class RSFocusMarkLayer: CALayer {
13 + // Use camera.app's focus mark size as default
14 + @objc open var size = CGSize(width: 76, height: 76)
15 + // Use camera.app's focus mark sight as default
16 + @objc open var sight: CGFloat = 6
17 + // Use camera.app's focus mark color as default
18 + @objc open var strokeColor = UIColor("#ffcc00").cgColor
19 + @objc open var strokeWidth: CGFloat = 1
20 + @objc open var delay: CFTimeInterval = 1
21 + @objc open var canDraw = false
22 +
23 + @objc open var point : CGPoint = CGPoint(x: 0, y: 0) {
24 + didSet {
25 + DispatchQueue.main.async(execute: {
26 + self.canDraw = true
27 + self.setNeedsDisplay()
28 + })
29 +
30 + let when = DispatchTime.now() + Double(Int64(self.delay * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)
31 + DispatchQueue.main.asyncAfter(deadline: when, execute: {
32 + self.canDraw = false
33 + self.setNeedsDisplay()
34 + })
35 + }
36 + }
37 +
38 + override open func draw(in ctx: CGContext) {
39 + if !self.canDraw {
40 + return
41 + }
42 +
43 + ctx.saveGState()
44 +
45 + ctx.setShouldAntialias(true)
46 + ctx.setAllowsAntialiasing(true)
47 + ctx.setFillColor(UIColor.clear.cgColor)
48 + ctx.setStrokeColor(self.strokeColor)
49 + ctx.setLineWidth(self.strokeWidth)
50 +
51 + // Rect
52 + ctx.stroke(CGRect(x: self.point.x - self.size.width / 2.0, y: self.point.y - self.size.height / 2.0, width: self.size.width, height: self.size.height))
53 +
54 + // Focus
55 + for i in 0..<4 {
56 + var endPoint: CGPoint
57 + switch i {
58 + case 0:
59 + ctx.move(to: CGPoint(x: self.point.x, y: self.point.y - self.size.height / 2.0))
60 + endPoint = CGPoint(x: self.point.x, y: self.point.y - self.size.height / 2.0 + self.sight)
61 + case 1:
62 + ctx.move(to: CGPoint(x: self.point.x, y: self.point.y + self.size.height / 2.0))
63 + endPoint = CGPoint(x: self.point.x, y: self.point.y + self.size.height / 2.0 - self.sight)
64 + case 2:
65 + ctx.move(to: CGPoint(x: self.point.x - self.size.width / 2.0, y: self.point.y))
66 + endPoint = CGPoint(x: self.point.x - self.size.width / 2.0 + self.sight, y: self.point.y)
67 + case 3:
68 + ctx.move(to: CGPoint(x: self.point.x + self.size.width / 2.0, y: self.point.y))
69 + endPoint = CGPoint(x: self.point.x + self.size.width / 2.0 - self.sight, y: self.point.y)
70 + default:
71 + endPoint = CGPoint(x: 0, y: 0)
72 + }
73 + ctx.addLine(to: CGPoint(x: endPoint.x, y: endPoint.y))
74 + }
75 +
76 + ctx.drawPath(using: CGPathDrawingMode.fillStroke)
77 +
78 + ctx.restoreGState()
79 + }
80 +}
1 +//
2 +// RSITF14Generator.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/13/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +
11 +// http://www.gs1au.org/assets/documents/info/user_manuals/barcode_technical_details/ITF_14_Barcode_Structure.pdf
12 +// http://www.barcodeisland.com/int2of5.phtml
13 +open class RSITF14Generator: RSITFGenerator {
14 + override open func isValid(_ contents: String) -> Bool {
15 + return super.isValid(contents) && contents.length() == 14
16 + }
17 +}
1 +//
2 +// RSITFGenerator.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/11/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +
11 +// http://www.barcodeisland.com/int2of5.phtml
12 +open class RSITFGenerator: RSAbstractCodeGenerator {
13 + let ITF_CHARACTER_ENCODINGS = [
14 + "00110",
15 + "10001",
16 + "01001",
17 + "11000",
18 + "00101",
19 + "10100",
20 + "01100",
21 + "00011",
22 + "10010",
23 + "01010",
24 + ]
25 +
26 + override open func isValid(_ contents: String) -> Bool {
27 + return super.isValid(contents) && contents.length() % 2 == 0
28 + }
29 +
30 + override open func initiator() -> String {
31 + return "1010"
32 + }
33 +
34 + override open func terminator() -> String {
35 + return "1101"
36 + }
37 +
38 + override open func barcode(_ contents: String) -> String {
39 + var barcode = ""
40 + for i in 0..<contents.length() / 2 {
41 + if let pair = contents.substring(i * 2, length: 2) {
42 + let bars = ITF_CHARACTER_ENCODINGS[Int(pair[0])!]
43 + let spaces = ITF_CHARACTER_ENCODINGS[Int(pair[1])!]
44 +
45 + for j in 0..<10 {
46 + if j % 2 == 0 {
47 + let bar = Int(bars[j / 2])
48 + if bar == 1 {
49 + barcode += "11"
50 + } else {
51 + barcode += "1"
52 + }
53 + } else {
54 + let space = Int(spaces[j / 2])
55 + if space == 1 {
56 + barcode += "00"
57 + } else {
58 + barcode += "0"
59 + }
60 + }
61 + }
62 + }
63 + }
64 + return barcode
65 + }
66 +}
1 +//
2 +// RSUPCEGenerator.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/11/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +
11 +// http://www.sly.com.tw/skill/know/new_page_6.htm
12 +// http://mdn.morovia.com/kb/UPCE-Specification-10634.html
13 +// http://mdn.morovia.com/kb/UPCA-Specification-10632.html
14 +// http://www.barcodeisland.com/upce.phtml
15 +open class RSUPCEGenerator: RSAbstractCodeGenerator, RSCheckDigitGenerator {
16 + let UPCE_ODD_ENCODINGS = [
17 + "0001101",
18 + "0011001",
19 + "0010011",
20 + "0111101",
21 + "0100011",
22 + "0110001",
23 + "0101111",
24 + "0111011",
25 + "0110111",
26 + "0001011"
27 + ]
28 +
29 + let UPCE_EVEN_ENCODINGS = [
30 + "0100111",
31 + "0110011",
32 + "0011011",
33 + "0100001",
34 + "0011101",
35 + "0111001",
36 + "0000101",
37 + "0010001",
38 + "0001001",
39 + "0010111"
40 + ]
41 +
42 + let UPCE_SEQUENCES = [
43 + "000111",
44 + "001011",
45 + "001101",
46 + "001110",
47 + "010011",
48 + "011001",
49 + "011100",
50 + "010101",
51 + "010110",
52 + "011010"
53 + ]
54 +
55 + func convert2UPC_A(_ contents:String) -> String {
56 + var upc_a = ""
57 + if let code = contents.substring(1, length: contents.length() - 2) {
58 + let lastDigit = Int(code[code.length() - 1])!
59 + var insertDigits = "0000"
60 + switch lastDigit {
61 + case 0...2:
62 + upc_a += code.substring(0, length: 2) + String(lastDigit) + insertDigits + code.substring(2, length: 3)
63 + case 3:
64 + insertDigits = "00000"
65 + upc_a += code.substring(0, length: 3) + insertDigits + code.substring(3, length: 2)
66 + case 4:
67 + insertDigits = "00000"
68 + upc_a += code.substring(0, length: 4) + insertDigits + code.substring(4, length: 1)
69 + default:
70 + upc_a += code.substring(0, length: 5) + insertDigits + String(lastDigit)
71 + }
72 + }
73 + return "00" + upc_a
74 + }
75 +
76 + override open func isValid(_ contents: String) -> Bool {
77 + return super.isValid(contents)
78 + && contents.length() == 8
79 + && Int(contents[0])! == 0
80 + && contents[contents.length() - 1] == self.checkDigit(contents)
81 + }
82 +
83 + override open func initiator() -> String {
84 + return "101"
85 + }
86 +
87 + override open func terminator() -> String {
88 + return "010101"
89 + }
90 +
91 + override open func barcode(_ contents: String) -> String {
92 + let checkValue = Int(contents[contents.length() - 1])!
93 + let sequence = UPCE_SEQUENCES[checkValue]
94 + var barcode = ""
95 + for i in 1..<contents.length() - 1 {
96 + let digit = Int(contents[i])!
97 + if Int(sequence[i - 1])! % 2 == 0 {
98 + barcode += UPCE_EVEN_ENCODINGS[digit]
99 + } else {
100 + barcode += UPCE_ODD_ENCODINGS[digit]
101 + }
102 + }
103 + return barcode
104 + }
105 +
106 + // MARK: RSCheckDigitGenerator
107 +
108 + open func checkDigit(_ contents: String) -> String {
109 + /*
110 + UPC-A check digit is calculated using standard Mod10 method. Here outlines the steps to calculate UPC-A check digit:
111 +
112 + From the right to left, start with odd position, assign the odd/even position to each digit.
113 + Sum all digits in odd position and multiply the result by 3.
114 + Sum all digits in even position.
115 + Sum the results of step 3 and step 4.
116 + divide the result of step 4 by 10. The check digit is the number which adds the remainder to 10.
117 + If there is no remainder then the check digit equals zero.
118 + */
119 + let upc_a = self.convert2UPC_A(contents)
120 + var sum_odd = 0
121 + var sum_even = 0
122 + for i in 0..<upc_a.length() {
123 + let digit = Int(upc_a[i])!
124 + if i % 2 == 0 {
125 + sum_even += digit
126 + } else {
127 + sum_odd += digit
128 + }
129 + }
130 + let remainder = (sum_even + sum_odd * 3) % 10
131 + return String(remainder == 0 ? remainder : 10 - remainder)
132 + }
133 +}
1 +//
2 +// RSUnifiedCodeGenerator.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/10/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import Foundation
10 +import UIKit
11 +import AVFoundation
12 +
13 +open class RSUnifiedCodeGenerator: RSCodeGenerator {
14 +
15 + open var isBuiltInCode128GeneratorSelected = false
16 + open var fillColor: UIColor = UIColor.white
17 + open var strokeColor: UIColor = UIColor.black
18 +
19 + open class var shared: RSUnifiedCodeGenerator {
20 + return UnifiedCodeGeneratorSharedInstance
21 + }
22 +
23 + // MARK: RSCodeGenerator
24 +
25 + open func isValid(_ contents: String) -> Bool {
26 + print("Use RSUnifiedCodeValidator.shared.isValid(contents:String, machineReadableCodeObjectType: String) instead")
27 + return false
28 + }
29 +
30 + open func generateCode(_ contents: String, inputCorrectionLevel: InputCorrectionLevel, machineReadableCodeObjectType: String, targetSize: CGSize? = nil) -> UIImage? {
31 + var codeGenerator: RSCodeGenerator?
32 + switch machineReadableCodeObjectType {
33 + case AVMetadataObject.ObjectType.qr.rawValue, AVMetadataObject.ObjectType.pdf417.rawValue, AVMetadataObject.ObjectType.aztec.rawValue:
34 + return RSAbstractCodeGenerator.generateCode(contents, inputCorrectionLevel: inputCorrectionLevel, filterName: RSAbstractCodeGenerator.filterName(machineReadableCodeObjectType), targetSize: targetSize, fillColor: fillColor, strokeColor: strokeColor)
35 + case AVMetadataObject.ObjectType.code39.rawValue:
36 + codeGenerator = RSCode39Generator()
37 + case AVMetadataObject.ObjectType.code39Mod43.rawValue:
38 + codeGenerator = RSCode39Mod43Generator()
39 + case AVMetadataObject.ObjectType.ean8.rawValue:
40 + codeGenerator = RSEAN8Generator()
41 + case AVMetadataObject.ObjectType.ean13.rawValue:
42 + codeGenerator = RSEAN13Generator()
43 + case AVMetadataObject.ObjectType.interleaved2of5.rawValue:
44 + codeGenerator = RSITFGenerator()
45 + case AVMetadataObject.ObjectType.itf14.rawValue:
46 + codeGenerator = RSITF14Generator()
47 + case AVMetadataObject.ObjectType.upce.rawValue:
48 + codeGenerator = RSUPCEGenerator()
49 + case AVMetadataObject.ObjectType.code93.rawValue:
50 + codeGenerator = RSCode93Generator()
51 + // iOS 8 included, but my implementation's performance is better :)
52 + case AVMetadataObject.ObjectType.code128.rawValue:
53 + if self.isBuiltInCode128GeneratorSelected {
54 + return RSAbstractCodeGenerator.generateCode(contents, inputCorrectionLevel: inputCorrectionLevel, filterName: RSAbstractCodeGenerator.filterName(machineReadableCodeObjectType), targetSize: targetSize, fillColor: fillColor, strokeColor: strokeColor)
55 + } else {
56 + codeGenerator = RSCode128Generator()
57 + }
58 + case AVMetadataObject.ObjectType.dataMatrix.rawValue:
59 + codeGenerator = RSCodeDataMatrixGenerator()
60 + case RSBarcodesTypeISBN13Code:
61 + codeGenerator = RSISBN13Generator()
62 + case RSBarcodesTypeISSN13Code:
63 + codeGenerator = RSISSN13Generator()
64 + case RSBarcodesTypeExtendedCode39Code:
65 + codeGenerator = RSExtendedCode39Generator()
66 + default:
67 + print("No code generator selected.")
68 + }
69 +
70 + if codeGenerator != nil {
71 + codeGenerator!.fillColor = self.fillColor
72 + codeGenerator!.strokeColor = self.strokeColor
73 + return codeGenerator!.generateCode(contents, inputCorrectionLevel: inputCorrectionLevel, machineReadableCodeObjectType: machineReadableCodeObjectType, targetSize: targetSize)
74 + } else {
75 + return nil
76 + }
77 + }
78 +
79 + open func generateCode(_ contents: String, machineReadableCodeObjectType: String, targetSize: CGSize? = nil) -> UIImage? {
80 + return self.generateCode(contents, inputCorrectionLevel: .Medium, machineReadableCodeObjectType: machineReadableCodeObjectType, targetSize: targetSize)
81 + }
82 +
83 + open func generateCode(_ machineReadableCodeObject: AVMetadataMachineReadableCodeObject, inputCorrectionLevel: InputCorrectionLevel, targetSize: CGSize? = nil) -> UIImage? {
84 + return self.generateCode(machineReadableCodeObject.stringValue!, inputCorrectionLevel: inputCorrectionLevel, machineReadableCodeObjectType: machineReadableCodeObject.type.rawValue, targetSize: targetSize)
85 + }
86 +
87 + open func generateCode(_ machineReadableCodeObject: AVMetadataMachineReadableCodeObject, targetSize: CGSize? = nil) -> UIImage? {
88 + return self.generateCode(machineReadableCodeObject, inputCorrectionLevel: .Medium, targetSize: targetSize)
89 + }
90 +}
91 +
92 +let UnifiedCodeGeneratorSharedInstance = RSUnifiedCodeGenerator()
1 +//
2 +// RSUnifiedCodeValidator.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 10/3/16.
6 +// Copyright (c) 2016 P.D.Q. All rights reserved.
7 +//
8 +
9 +import Foundation
10 +import AVFoundation
11 +
12 +open class RSUnifiedCodeValidator {
13 + open class var shared: RSUnifiedCodeValidator {
14 + return UnifiedCodeValidatorSharedInstance
15 + }
16 +
17 + open func isValid(_ contents:String, machineReadableCodeObjectType: String) -> Bool {
18 + var codeGenerator: RSCodeGenerator?
19 + switch machineReadableCodeObjectType {
20 + case AVMetadataObject.ObjectType.qr.rawValue, AVMetadataObject.ObjectType.pdf417.rawValue, AVMetadataObject.ObjectType.aztec.rawValue:
21 + return false
22 + case AVMetadataObject.ObjectType.code39.rawValue:
23 + codeGenerator = RSCode39Generator()
24 + case AVMetadataObject.ObjectType.code39Mod43.rawValue:
25 + codeGenerator = RSCode39Mod43Generator()
26 + case AVMetadataObject.ObjectType.ean8.rawValue:
27 + codeGenerator = RSEAN8Generator()
28 + case AVMetadataObject.ObjectType.ean13.rawValue:
29 + codeGenerator = RSEAN13Generator()
30 + case AVMetadataObject.ObjectType.interleaved2of5.rawValue:
31 + codeGenerator = RSITFGenerator()
32 + case AVMetadataObject.ObjectType.itf14.rawValue:
33 + codeGenerator = RSITF14Generator()
34 + case AVMetadataObject.ObjectType.upce.rawValue:
35 + codeGenerator = RSUPCEGenerator()
36 + case AVMetadataObject.ObjectType.code93.rawValue:
37 + codeGenerator = RSCode93Generator()
38 + case AVMetadataObject.ObjectType.code128.rawValue:
39 + codeGenerator = RSCode128Generator()
40 + case AVMetadataObject.ObjectType.dataMatrix.rawValue:
41 + codeGenerator = RSCodeDataMatrixGenerator()
42 + case RSBarcodesTypeISBN13Code:
43 + codeGenerator = RSISBN13Generator()
44 + case RSBarcodesTypeISSN13Code:
45 + codeGenerator = RSISSN13Generator()
46 + case RSBarcodesTypeExtendedCode39Code:
47 + codeGenerator = RSExtendedCode39Generator()
48 + default:
49 + print("No code generator selected.")
50 + return false
51 + }
52 + return codeGenerator!.isValid(contents)
53 + }
54 +}
55 +let UnifiedCodeValidatorSharedInstance = RSUnifiedCodeValidator()
1 +//
2 +// Ext.swift
3 +// RSBarcodesSample
4 +//
5 +// Created by R0CKSTAR on 6/10/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +
11 +extension String {
12 + func length() -> Int {
13 + return self.count
14 + }
15 +
16 + func trim() -> String {
17 + return self.trimmingCharacters(in: .whitespacesAndNewlines)
18 + }
19 +
20 + func substring(_ location:Int, length:Int) -> String! {
21 + return (self as NSString).substring(with: NSMakeRange(location, length))
22 + }
23 +
24 + subscript(index: Int) -> String! {
25 + get {
26 + return self.substring(index, length: 1)
27 + }
28 + }
29 +
30 + func location(_ other: String) -> Int {
31 + return (self as NSString).range(of: other).location
32 + }
33 +
34 + func contains(_ other: String) -> Bool {
35 + return (self as NSString).contains(other)
36 + }
37 +
38 + // http://stackoverflow.com/questions/6644004/how-to-check-if-nsstring-is-contains-a-numeric-value
39 + func isNumeric() -> Bool {
40 + return (self as NSString).rangeOfCharacter(from: CharacterSet.decimalDigits.inverted).location == NSNotFound
41 + }
42 +}
1 +//
2 +// UIColorExtension.swift
3 +// HEXColor
4 +//
5 +// Created by R0CKSTAR on 6/13/14.
6 +// Copyright (c) 2014 P.D.Q. All rights reserved.
7 +//
8 +
9 +import UIKit
10 +
11 +/**
12 + MissingHashMarkAsPrefix: "Invalid RGB string, missing '#' as prefix"
13 + UnableToScanHexValue: "Scan hex error"
14 + MismatchedHexStringLength: "Invalid RGB string, number of characters after '#' should be either 3, 4, 6 or 8"
15 + */
16 +public enum UIColorInputError : Error {
17 + case missingHashMarkAsPrefix,
18 + unableToScanHexValue,
19 + mismatchedHexStringLength
20 +}
21 +
22 +extension UIColor {
23 + /**
24 + The shorthand three-digit hexadecimal representation of color.
25 + #RGB defines to the color #RRGGBB.
26 +
27 + - parameter hex3: Three-digit hexadecimal value.
28 + - parameter alpha: 0.0 - 1.0. The default is 1.0.
29 + */
30 + @objc public convenience init(hex3: UInt16, alpha: CGFloat = 1) {
31 + let divisor = CGFloat(15)
32 + let red = CGFloat((hex3 & 0xF00) >> 8) / divisor
33 + let green = CGFloat((hex3 & 0x0F0) >> 4) / divisor
34 + let blue = CGFloat( hex3 & 0x00F ) / divisor
35 + self.init(red: red, green: green, blue: blue, alpha: alpha)
36 + }
37 +
38 + /**
39 + The shorthand four-digit hexadecimal representation of color with alpha.
40 + #RGBA defines to the color #RRGGBBAA.
41 +
42 + - parameter hex4: Four-digit hexadecimal value.
43 + */
44 + @objc public convenience init(hex4: UInt16) {
45 + let divisor = CGFloat(15)
46 + let red = CGFloat((hex4 & 0xF000) >> 12) / divisor
47 + let green = CGFloat((hex4 & 0x0F00) >> 8) / divisor
48 + let blue = CGFloat((hex4 & 0x00F0) >> 4) / divisor
49 + let alpha = CGFloat( hex4 & 0x000F ) / divisor
50 + self.init(red: red, green: green, blue: blue, alpha: alpha)
51 + }
52 +
53 + /**
54 + The six-digit hexadecimal representation of color of the form #RRGGBB.
55 +
56 + - parameter hex6: Six-digit hexadecimal value.
57 + */
58 + @objc public convenience init(hex6: UInt32, alpha: CGFloat = 1) {
59 + let divisor = CGFloat(255)
60 + let red = CGFloat((hex6 & 0xFF0000) >> 16) / divisor
61 + let green = CGFloat((hex6 & 0x00FF00) >> 8) / divisor
62 + let blue = CGFloat( hex6 & 0x0000FF ) / divisor
63 + self.init(red: red, green: green, blue: blue, alpha: alpha)
64 + }
65 +
66 + /**
67 + The six-digit hexadecimal representation of color with alpha of the form #RRGGBBAA.
68 +
69 + - parameter hex8: Eight-digit hexadecimal value.
70 + */
71 + @objc public convenience init(hex8: UInt32) {
72 + let divisor = CGFloat(255)
73 + let red = CGFloat((hex8 & 0xFF000000) >> 24) / divisor
74 + let green = CGFloat((hex8 & 0x00FF0000) >> 16) / divisor
75 + let blue = CGFloat((hex8 & 0x0000FF00) >> 8) / divisor
76 + let alpha = CGFloat( hex8 & 0x000000FF ) / divisor
77 + self.init(red: red, green: green, blue: blue, alpha: alpha)
78 + }
79 +
80 + /**
81 + The rgba string representation of color with alpha of the form #RRGGBBAA/#RRGGBB, throws error.
82 +
83 + - parameter rgba: String value.
84 + */
85 + @objc public convenience init(rgba_throws rgba: String) throws {
86 + guard rgba.hasPrefix("#") else {
87 + throw UIColorInputError.missingHashMarkAsPrefix
88 + }
89 +
90 + let index = rgba.index(rgba.startIndex, offsetBy: 1)
91 + let hexString = String(rgba[index...])
92 + var hexValue: UInt32 = 0
93 +
94 + guard Scanner(string: hexString).scanHexInt32(&hexValue) else {
95 + throw UIColorInputError.unableToScanHexValue
96 + }
97 +
98 + switch (hexString.count) {
99 + case 3:
100 + self.init(hex3: UInt16(hexValue))
101 + case 4:
102 + self.init(hex4: UInt16(hexValue))
103 + case 6:
104 + self.init(hex6: hexValue)
105 + case 8:
106 + self.init(hex8: hexValue)
107 + default:
108 + throw UIColorInputError.mismatchedHexStringLength
109 + }
110 + }
111 +
112 + /**
113 + The rgba string representation of color with alpha of the form #RRGGBBAA/#RRGGBB, fails to default color.
114 +
115 + - parameter rgba: String value.
116 + */
117 + @objc public convenience init(_ rgba: String, defaultColor: UIColor = UIColor.clear) {
118 + guard let color = try? UIColor(rgba_throws: rgba) else {
119 + self.init(cgColor: defaultColor.cgColor)
120 + return
121 + }
122 + self.init(cgColor: color.cgColor)
123 + }
124 +
125 + /**
126 + Hex string of a UIColor instance.
127 +
128 + - parameter includeAlpha: Whether the alpha should be included.
129 + */
130 + @objc public func hexString(_ includeAlpha: Bool = true) -> String {
131 + var r: CGFloat = 0
132 + var g: CGFloat = 0
133 + var b: CGFloat = 0
134 + var a: CGFloat = 0
135 + self.getRed(&r, green: &g, blue: &b, alpha: &a)
136 +
137 + if includeAlpha {
138 + return String(format: "#%02X%02X%02X%02X", Int(r * 255), Int(g * 255), Int(b * 255), Int(a * 255))
139 + } else {
140 + return String(format: "#%02X%02X%02X", Int(r * 255), Int(g * 255), Int(b * 255))
141 + }
142 + }
143 +}
1 # Acknowledgements 1 # Acknowledgements
2 This application makes use of the following third party libraries: 2 This application makes use of the following third party libraries:
3 +
4 +## RSBarcodes_Swift
5 +
6 +The MIT License (MIT)
7 +
8 +Copyright (c) 2012-2014 P.D.Q.
9 +
10 +Permission is hereby granted, free of charge, to any person obtaining a copy of
11 +this software and associated documentation files (the "Software"), to deal in
12 +the Software without restriction, including without limitation the rights to
13 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
14 +the Software, and to permit persons to whom the Software is furnished to do so,
15 +subject to the following conditions:
16 +
17 +The above copyright notice and this permission notice shall be included in all
18 +copies or substantial portions of the Software.
19 +
20 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
22 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
23 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 +
3 Generated by CocoaPods - https://cocoapods.org 27 Generated by CocoaPods - https://cocoapods.org
......
...@@ -14,6 +14,36 @@ ...@@ -14,6 +14,36 @@
14 </dict> 14 </dict>
15 <dict> 15 <dict>
16 <key>FooterText</key> 16 <key>FooterText</key>
17 + <string>The MIT License (MIT)
18 +
19 +Copyright (c) 2012-2014 P.D.Q.
20 +
21 +Permission is hereby granted, free of charge, to any person obtaining a copy of
22 +this software and associated documentation files (the "Software"), to deal in
23 +the Software without restriction, including without limitation the rights to
24 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
25 +the Software, and to permit persons to whom the Software is furnished to do so,
26 +subject to the following conditions:
27 +
28 +The above copyright notice and this permission notice shall be included in all
29 +copies or substantial portions of the Software.
30 +
31 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
33 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
34 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
35 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
36 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 +</string>
38 + <key>License</key>
39 + <string>MIT</string>
40 + <key>Title</key>
41 + <string>RSBarcodes_Swift</string>
42 + <key>Type</key>
43 + <string>PSGroupSpecifier</string>
44 + </dict>
45 + <dict>
46 + <key>FooterText</key>
17 <string>Generated by CocoaPods - https://cocoapods.org</string> 47 <string>Generated by CocoaPods - https://cocoapods.org</string>
18 <key>Title</key> 48 <key>Title</key>
19 <string></string> 49 <string></string>
......
1 CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 1 CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
2 +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RSBarcodes_Swift"
2 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RSBarcodes_Swift/RSBarcodes_Swift.framework/Headers"
5 +LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks'
6 +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
7 +OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "CoreImage" -framework "QuartzCore" -framework "RSBarcodes_Swift"
8 +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
3 PODS_BUILD_DIR = ${BUILD_DIR} 9 PODS_BUILD_DIR = ${BUILD_DIR}
4 PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
5 PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
......
1 CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 1 CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
2 +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RSBarcodes_Swift"
2 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RSBarcodes_Swift/RSBarcodes_Swift.framework/Headers"
5 +LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks'
6 +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
7 +OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "CoreImage" -framework "QuartzCore" -framework "RSBarcodes_Swift"
8 +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
3 PODS_BUILD_DIR = ${BUILD_DIR} 9 PODS_BUILD_DIR = ${BUILD_DIR}
4 PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
5 PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 +<plist version="1.0">
4 +<dict>
5 + <key>CFBundleDevelopmentRegion</key>
6 + <string>en</string>
7 + <key>CFBundleExecutable</key>
8 + <string>${EXECUTABLE_NAME}</string>
9 + <key>CFBundleIdentifier</key>
10 + <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
11 + <key>CFBundleInfoDictionaryVersion</key>
12 + <string>6.0</string>
13 + <key>CFBundleName</key>
14 + <string>${PRODUCT_NAME}</string>
15 + <key>CFBundlePackageType</key>
16 + <string>FMWK</string>
17 + <key>CFBundleShortVersionString</key>
18 + <string>5.1.1</string>
19 + <key>CFBundleSignature</key>
20 + <string>????</string>
21 + <key>CFBundleVersion</key>
22 + <string>${CURRENT_PROJECT_VERSION}</string>
23 + <key>NSPrincipalClass</key>
24 + <string></string>
25 +</dict>
26 +</plist>
1 +#import <Foundation/Foundation.h>
2 +@interface PodsDummy_RSBarcodes_Swift : NSObject
3 +@end
4 +@implementation PodsDummy_RSBarcodes_Swift
5 +@end
1 +#ifdef __OBJC__
2 +#import <UIKit/UIKit.h>
3 +#else
4 +#ifndef FOUNDATION_EXPORT
5 +#if defined(__cplusplus)
6 +#define FOUNDATION_EXPORT extern "C"
7 +#else
8 +#define FOUNDATION_EXPORT extern
9 +#endif
10 +#endif
11 +#endif
12 +
1 +#ifdef __OBJC__
2 +#import <UIKit/UIKit.h>
3 +#else
4 +#ifndef FOUNDATION_EXPORT
5 +#if defined(__cplusplus)
6 +#define FOUNDATION_EXPORT extern "C"
7 +#else
8 +#define FOUNDATION_EXPORT extern
9 +#endif
10 +#endif
11 +#endif
12 +
13 +
14 +FOUNDATION_EXPORT double RSBarcodes_SwiftVersionNumber;
15 +FOUNDATION_EXPORT const unsigned char RSBarcodes_SwiftVersionString[];
16 +
1 +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
2 +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RSBarcodes_Swift
3 +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
5 +OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "CoreImage" -framework "QuartzCore"
6 +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
7 +PODS_BUILD_DIR = ${BUILD_DIR}
8 +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
9 +PODS_ROOT = ${SRCROOT}
10 +PODS_TARGET_SRCROOT = ${PODS_ROOT}/RSBarcodes_Swift
11 +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
12 +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
13 +SKIP_INSTALL = YES
14 +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
1 +framework module RSBarcodes_Swift {
2 + umbrella header "RSBarcodes_Swift-umbrella.h"
3 +
4 + export *
5 + module * { export * }
6 +}
1 +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
2 +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RSBarcodes_Swift
3 +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
4 +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift
5 +OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "CoreImage" -framework "QuartzCore"
6 +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
7 +PODS_BUILD_DIR = ${BUILD_DIR}
8 +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
9 +PODS_ROOT = ${SRCROOT}
10 +PODS_TARGET_SRCROOT = ${PODS_ROOT}/RSBarcodes_Swift
11 +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
12 +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
13 +SKIP_INSTALL = YES
14 +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key> 7 <key>WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>1</integer> 10 + <integer>2</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......