Showing
44 changed files
with
3288 additions
and
53 deletions
No preview for this file type
No preview for this file type
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 | ... | ... |
... | @@ -7,37 +7,134 @@ | ... | @@ -7,37 +7,134 @@ |
7 | objects = { | 7 | objects = { |
8 | 8 | ||
9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
10 | - 3CB94267BAAACA600E34164D0EE6A83D /* Pods-WarplySDKFrameworkIOS-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = F4852F41D1761CFBF0B901A88611A432 /* Pods-WarplySDKFrameworkIOS-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; | 10 | + 05E9C825ED6CC6894EC0046E432B221C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A944E2A381FC1C22728EC807559C4C86 /* Foundation.framework */; }; |
11 | - 94CF3909D90B545F11886D2920E02763 /* Pods-WarplySDKFrameworkIOS-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EE2A6FC0243126EF2A5265AA25C2861 /* Pods-WarplySDKFrameworkIOS-dummy.m */; }; | 11 | + 12565F53551E3F99FF1563B2EAB7245E /* Pods-WarplySDKFrameworkIOS-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = F4852F41D1761CFBF0B901A88611A432 /* Pods-WarplySDKFrameworkIOS-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
12 | - D529907ED9CC201D0510CD14373C9186 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; | 12 | + 1332AF6141E5F1FF39B19754800F8A5C /* UIColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0568EC6DAF22B32CDD16856911FD4105 /* UIColorExtension.swift */; }; |
13 | + 27EA55D886E55816FA37C6BFFAA1EA4F /* RSUnifiedCodeValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8F77A025F8AD377874E5F3E19AE7C79 /* RSUnifiedCodeValidator.swift */; }; | ||
14 | + 2A144930A1E065A3AF77C76FD7011341 /* CoreImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DA23F9D788EEFAE7C7662FDC4D42A5E /* CoreImage.framework */; }; | ||
15 | + 302B4B469989DB72266490E8A1382417 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A6C7186A58209BD865768FEEECE45879 /* QuartzCore.framework */; }; | ||
16 | + 39A13850C2B4154BEB6B1748ADC04201 /* RSCodeDataMatrixGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3AB8A056DF50685033466069E237A14 /* RSCodeDataMatrixGenerator.swift */; }; | ||
17 | + 3C7289263FEAA4191FCFE25988044EBD /* RSITFGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDDED3429B0E0BDC158E1EC36A226D29 /* RSITFGenerator.swift */; }; | ||
18 | + 3F72F4E3E3131D47CE00F3A554669E87 /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BBA779B4FF00402FEC4985CF4A7B9BC /* StringExtension.swift */; }; | ||
19 | + 41E2817A8EF001F43FB61CFCE1457B4E /* RSCode39Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70EA7F4B9944D0F81ADE63C29F6B74A /* RSCode39Generator.swift */; }; | ||
20 | + 69FCE3D80F2014719DA1AB10BC26E730 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33B191A7CD5F1D4BA6167963BE6ECFE1 /* AVFoundation.framework */; }; | ||
21 | + 6BD4D1A3C0962FFFE47B84FE981578A7 /* RSITF14Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDF9008817996E19632780D0A4BFB8B5 /* RSITF14Generator.swift */; }; | ||
22 | + 711E684F2D76C938CB35E2730E53B9CC /* RSCode93Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 214258C0DC11D5A201F9293FF484DD2E /* RSCode93Generator.swift */; }; | ||
23 | + 717423952F54594D6F8C8C1F1C1DF6DD /* RSUPCEGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE4AEAC7C2D6CCA5D47E35AEDB153D83 /* RSUPCEGenerator.swift */; }; | ||
24 | + 7DD2212D6D7B540985937C6930994BEA /* ContextMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BA7ECA7DEC0464AB14CEC8FB73C16DA /* ContextMaker.swift */; }; | ||
25 | + 85FAD53FB51819F05F3310CFABB2CCED /* RSEANGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD3AA69B1B0D500239BE47CA68349021 /* RSEANGenerator.swift */; }; | ||
26 | + 8C85310AC111885226FF0D25B41FAEF2 /* RSFocusMarkLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E107504D90AB42B9BC594C6722D0182A /* RSFocusMarkLayer.swift */; }; | ||
27 | + 9DEA4BF4A7873C633E2FF158481CD4EB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A944E2A381FC1C22728EC807559C4C86 /* Foundation.framework */; }; | ||
28 | + 9EB3F27C25339307654AB4B6F08CD966 /* RSUnifiedCodeGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 680FDAB9088C5319CE20751DE30DEBCE /* RSUnifiedCodeGenerator.swift */; }; | ||
29 | + B6234C50A73A62C42CDD5067C44663BA /* RSCodeGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55B7BBDDEABCF9D24B31EA0ADE75DFF3 /* RSCodeGenerator.swift */; }; | ||
30 | + BC7E203C1F132BA3955B93BB02044830 /* RSCornersLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3455E17394A5AB2F88546F52599FE8C /* RSCornersLayer.swift */; }; | ||
31 | + D15FAF53AAD1789027D0E0EC27B46E82 /* RSBarcodes_Swift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C280F49295B1757C26C05F383F8638 /* RSBarcodes_Swift-dummy.m */; }; | ||
32 | + D697AA0DB2FFFA2459ACC459F8CA8794 /* RSCodeReaderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 858327FB4B5D770F80A8D44B7F52FE05 /* RSCodeReaderViewController.swift */; }; | ||
33 | + DC7CE7EBB97FBDE958725B1371F43E26 /* RSCodeLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B01FBA694263430A4BDB814D5211E16 /* RSCodeLayer.swift */; }; | ||
34 | + E05B0B3D85AD8264D06DD3404AAE0556 /* RSCode128Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A7EAD43A1CD4D812852352204C3D1FD /* RSCode128Generator.swift */; }; | ||
35 | + E2B6B038C8F1164C8981406BCE79AD90 /* Pods-WarplySDKFrameworkIOS-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EE2A6FC0243126EF2A5265AA25C2861 /* Pods-WarplySDKFrameworkIOS-dummy.m */; }; | ||
36 | + E7FFBBC5AF2005FCA69393FACA0226D2 /* RSBarcodes_Swift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = D25478B57CA940F484DDFB8F5FF981A6 /* RSBarcodes_Swift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; | ||
37 | + F278698D21257C92FE708357F26190D9 /* RSExtendedCode39Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD0C3768A6D9F31A32D63DFF071C8BF /* RSExtendedCode39Generator.swift */; }; | ||
38 | + FD09BC74BDA6FCCA44092100E4D2CFF8 /* RSCode39Mod43Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8B8044E2FEE81ADFF29C1084020BBEE /* RSCode39Mod43Generator.swift */; }; | ||
13 | /* End PBXBuildFile section */ | 39 | /* End PBXBuildFile section */ |
14 | 40 | ||
41 | +/* Begin PBXContainerItemProxy section */ | ||
42 | + F14FCC47D788B5F25BEE8E788680E46E /* PBXContainerItemProxy */ = { | ||
43 | + isa = PBXContainerItemProxy; | ||
44 | + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; | ||
45 | + proxyType = 1; | ||
46 | + remoteGlobalIDString = 3C896FA0C00DEA19240C4BFD2C54E0D3; | ||
47 | + remoteInfo = RSBarcodes_Swift; | ||
48 | + }; | ||
49 | +/* End PBXContainerItemProxy section */ | ||
50 | + | ||
15 | /* Begin PBXFileReference section */ | 51 | /* Begin PBXFileReference section */ |
52 | + 0568EC6DAF22B32CDD16856911FD4105 /* UIColorExtension.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIColorExtension.swift; path = Source/UIColorExtension.swift; sourceTree = "<group>"; }; | ||
16 | 070839992AB5311FCCD01EF9FA04CBDF /* Pods-WarplySDKFrameworkIOS.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-WarplySDKFrameworkIOS.modulemap"; sourceTree = "<group>"; }; | 53 | 070839992AB5311FCCD01EF9FA04CBDF /* Pods-WarplySDKFrameworkIOS.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-WarplySDKFrameworkIOS.modulemap"; sourceTree = "<group>"; }; |
54 | + 1B01FBA694263430A4BDB814D5211E16 /* RSCodeLayer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSCodeLayer.swift; path = Source/RSCodeLayer.swift; sourceTree = "<group>"; }; | ||
55 | + 214258C0DC11D5A201F9293FF484DD2E /* RSCode93Generator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSCode93Generator.swift; path = Source/RSCode93Generator.swift; sourceTree = "<group>"; }; | ||
17 | 2181B0326B7151E5D44851DC0B071D18 /* Pods-WarplySDKFrameworkIOS-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-WarplySDKFrameworkIOS-acknowledgements.plist"; sourceTree = "<group>"; }; | 56 | 2181B0326B7151E5D44851DC0B071D18 /* Pods-WarplySDKFrameworkIOS-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-WarplySDKFrameworkIOS-acknowledgements.plist"; sourceTree = "<group>"; }; |
57 | + 2363AF68813770FC1693F17099D7B4E2 /* RSBarcodes_Swift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RSBarcodes_Swift-prefix.pch"; sourceTree = "<group>"; }; | ||
58 | + 2A7EAD43A1CD4D812852352204C3D1FD /* RSCode128Generator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSCode128Generator.swift; path = Source/RSCode128Generator.swift; sourceTree = "<group>"; }; | ||
59 | + 33350D89813FDC0792B0D0B114B76A33 /* RSBarcodes_Swift */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RSBarcodes_Swift; path = RSBarcodes_Swift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
60 | + 33B191A7CD5F1D4BA6167963BE6ECFE1 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; }; | ||
61 | + 3BA7ECA7DEC0464AB14CEC8FB73C16DA /* ContextMaker.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ContextMaker.swift; path = Source/ContextMaker.swift; sourceTree = "<group>"; }; | ||
18 | 4C337411AA19624EC4CD26EC32EAD6EF /* Pods-WarplySDKFrameworkIOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-WarplySDKFrameworkIOS.debug.xcconfig"; sourceTree = "<group>"; }; | 62 | 4C337411AA19624EC4CD26EC32EAD6EF /* Pods-WarplySDKFrameworkIOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-WarplySDKFrameworkIOS.debug.xcconfig"; sourceTree = "<group>"; }; |
19 | 4EE2A6FC0243126EF2A5265AA25C2861 /* Pods-WarplySDKFrameworkIOS-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-WarplySDKFrameworkIOS-dummy.m"; sourceTree = "<group>"; }; | 63 | 4EE2A6FC0243126EF2A5265AA25C2861 /* Pods-WarplySDKFrameworkIOS-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-WarplySDKFrameworkIOS-dummy.m"; sourceTree = "<group>"; }; |
20 | - 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; | 64 | + 55B7BBDDEABCF9D24B31EA0ADE75DFF3 /* RSCodeGenerator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSCodeGenerator.swift; path = Source/RSCodeGenerator.swift; sourceTree = "<group>"; }; |
65 | + 5DA23F9D788EEFAE7C7662FDC4D42A5E /* CoreImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreImage.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreImage.framework; sourceTree = DEVELOPER_DIR; }; | ||
66 | + 680FDAB9088C5319CE20751DE30DEBCE /* RSUnifiedCodeGenerator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSUnifiedCodeGenerator.swift; path = Source/RSUnifiedCodeGenerator.swift; sourceTree = "<group>"; }; | ||
21 | 81FE1BFBEE8B0039BAB28F45E7423BC5 /* Pods-WarplySDKFrameworkIOS-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-WarplySDKFrameworkIOS-acknowledgements.markdown"; sourceTree = "<group>"; }; | 67 | 81FE1BFBEE8B0039BAB28F45E7423BC5 /* Pods-WarplySDKFrameworkIOS-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-WarplySDKFrameworkIOS-acknowledgements.markdown"; sourceTree = "<group>"; }; |
68 | + 858327FB4B5D770F80A8D44B7F52FE05 /* RSCodeReaderViewController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSCodeReaderViewController.swift; path = Source/RSCodeReaderViewController.swift; sourceTree = "<group>"; }; | ||
69 | + 8BBA779B4FF00402FEC4985CF4A7B9BC /* StringExtension.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StringExtension.swift; path = Source/StringExtension.swift; sourceTree = "<group>"; }; | ||
70 | + 8BD0C3768A6D9F31A32D63DFF071C8BF /* RSExtendedCode39Generator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSExtendedCode39Generator.swift; path = Source/RSExtendedCode39Generator.swift; sourceTree = "<group>"; }; | ||
22 | 8D9A6E342653A94C21E0FA8167A49109 /* Pods-WarplySDKFrameworkIOS-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-WarplySDKFrameworkIOS-Info.plist"; sourceTree = "<group>"; }; | 71 | 8D9A6E342653A94C21E0FA8167A49109 /* Pods-WarplySDKFrameworkIOS-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-WarplySDKFrameworkIOS-Info.plist"; sourceTree = "<group>"; }; |
23 | 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; | 72 | 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; |
73 | + A6C7186A58209BD865768FEEECE45879 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; | ||
74 | + A70EA7F4B9944D0F81ADE63C29F6B74A /* RSCode39Generator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSCode39Generator.swift; path = Source/RSCode39Generator.swift; sourceTree = "<group>"; }; | ||
75 | + A8F77A025F8AD377874E5F3E19AE7C79 /* RSUnifiedCodeValidator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSUnifiedCodeValidator.swift; path = Source/RSUnifiedCodeValidator.swift; sourceTree = "<group>"; }; | ||
76 | + A944E2A381FC1C22728EC807559C4C86 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; | ||
77 | + B898B8D01EB10CAD6EDFCEDAF24D96B0 /* RSBarcodes_Swift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RSBarcodes_Swift.release.xcconfig; sourceTree = "<group>"; }; | ||
78 | + C8BDB1FBE63E1D9091638224544830C3 /* RSBarcodes_Swift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RSBarcodes_Swift.debug.xcconfig; sourceTree = "<group>"; }; | ||
79 | + CCFA91CFAC9A2A8C13929A50AB27327D /* RSBarcodes_Swift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = RSBarcodes_Swift.modulemap; sourceTree = "<group>"; }; | ||
80 | + CD3AA69B1B0D500239BE47CA68349021 /* RSEANGenerator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSEANGenerator.swift; path = Source/RSEANGenerator.swift; sourceTree = "<group>"; }; | ||
81 | + CDDED3429B0E0BDC158E1EC36A226D29 /* RSITFGenerator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSITFGenerator.swift; path = Source/RSITFGenerator.swift; sourceTree = "<group>"; }; | ||
82 | + CDF9008817996E19632780D0A4BFB8B5 /* RSITF14Generator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSITF14Generator.swift; path = Source/RSITF14Generator.swift; sourceTree = "<group>"; }; | ||
83 | + CE4AEAC7C2D6CCA5D47E35AEDB153D83 /* RSUPCEGenerator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSUPCEGenerator.swift; path = Source/RSUPCEGenerator.swift; sourceTree = "<group>"; }; | ||
84 | + D25478B57CA940F484DDFB8F5FF981A6 /* RSBarcodes_Swift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RSBarcodes_Swift-umbrella.h"; sourceTree = "<group>"; }; | ||
85 | + E107504D90AB42B9BC594C6722D0182A /* RSFocusMarkLayer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSFocusMarkLayer.swift; path = Source/RSFocusMarkLayer.swift; sourceTree = "<group>"; }; | ||
86 | + E3455E17394A5AB2F88546F52599FE8C /* RSCornersLayer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSCornersLayer.swift; path = Source/RSCornersLayer.swift; sourceTree = "<group>"; }; | ||
87 | + E8C280F49295B1757C26C05F383F8638 /* RSBarcodes_Swift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "RSBarcodes_Swift-dummy.m"; sourceTree = "<group>"; }; | ||
24 | F1E7484B07BAD976C8F38EC1B9D2783C /* Pods-WarplySDKFrameworkIOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-WarplySDKFrameworkIOS.release.xcconfig"; sourceTree = "<group>"; }; | 88 | F1E7484B07BAD976C8F38EC1B9D2783C /* Pods-WarplySDKFrameworkIOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-WarplySDKFrameworkIOS.release.xcconfig"; sourceTree = "<group>"; }; |
89 | + F3AB8A056DF50685033466069E237A14 /* RSCodeDataMatrixGenerator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSCodeDataMatrixGenerator.swift; path = Source/RSCodeDataMatrixGenerator.swift; sourceTree = "<group>"; }; | ||
25 | F4852F41D1761CFBF0B901A88611A432 /* Pods-WarplySDKFrameworkIOS-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-WarplySDKFrameworkIOS-umbrella.h"; sourceTree = "<group>"; }; | 90 | F4852F41D1761CFBF0B901A88611A432 /* Pods-WarplySDKFrameworkIOS-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-WarplySDKFrameworkIOS-umbrella.h"; sourceTree = "<group>"; }; |
91 | + F5F3410744C4FAFD32980AF57D615CBF /* RSBarcodes_Swift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "RSBarcodes_Swift-Info.plist"; sourceTree = "<group>"; }; | ||
26 | F88D658AD0E099B29A131EF709CC6530 /* Pods-WarplySDKFrameworkIOS */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-WarplySDKFrameworkIOS"; path = Pods_WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | 92 | F88D658AD0E099B29A131EF709CC6530 /* Pods-WarplySDKFrameworkIOS */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-WarplySDKFrameworkIOS"; path = Pods_WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
93 | + F8B8044E2FEE81ADFF29C1084020BBEE /* RSCode39Mod43Generator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RSCode39Mod43Generator.swift; path = Source/RSCode39Mod43Generator.swift; sourceTree = "<group>"; }; | ||
27 | /* End PBXFileReference section */ | 94 | /* End PBXFileReference section */ |
28 | 95 | ||
29 | /* Begin PBXFrameworksBuildPhase section */ | 96 | /* Begin PBXFrameworksBuildPhase section */ |
30 | - 7A4FE7AD3238E2ECE0F4F0627A5C84E2 /* Frameworks */ = { | 97 | + 87FCBCA369E651BD607E728CDCA04868 /* Frameworks */ = { |
98 | + isa = PBXFrameworksBuildPhase; | ||
99 | + buildActionMask = 2147483647; | ||
100 | + files = ( | ||
101 | + 69FCE3D80F2014719DA1AB10BC26E730 /* AVFoundation.framework in Frameworks */, | ||
102 | + 2A144930A1E065A3AF77C76FD7011341 /* CoreImage.framework in Frameworks */, | ||
103 | + 9DEA4BF4A7873C633E2FF158481CD4EB /* Foundation.framework in Frameworks */, | ||
104 | + 302B4B469989DB72266490E8A1382417 /* QuartzCore.framework in Frameworks */, | ||
105 | + ); | ||
106 | + runOnlyForDeploymentPostprocessing = 0; | ||
107 | + }; | ||
108 | + F727AFF969F4390DC15E578713711206 /* Frameworks */ = { | ||
31 | isa = PBXFrameworksBuildPhase; | 109 | isa = PBXFrameworksBuildPhase; |
32 | buildActionMask = 2147483647; | 110 | buildActionMask = 2147483647; |
33 | files = ( | 111 | files = ( |
34 | - D529907ED9CC201D0510CD14373C9186 /* Foundation.framework in Frameworks */, | 112 | + 05E9C825ED6CC6894EC0046E432B221C /* Foundation.framework in Frameworks */, |
35 | ); | 113 | ); |
36 | runOnlyForDeploymentPostprocessing = 0; | 114 | runOnlyForDeploymentPostprocessing = 0; |
37 | }; | 115 | }; |
38 | /* End PBXFrameworksBuildPhase section */ | 116 | /* End PBXFrameworksBuildPhase section */ |
39 | 117 | ||
40 | /* Begin PBXGroup section */ | 118 | /* Begin PBXGroup section */ |
119 | + 0EEA9E9906DE882E95DFF9F8E6FC0981 /* Pods */ = { | ||
120 | + isa = PBXGroup; | ||
121 | + children = ( | ||
122 | + 291D453EAC07BC54E13A98D15C6D526E /* RSBarcodes_Swift */, | ||
123 | + ); | ||
124 | + name = Pods; | ||
125 | + sourceTree = "<group>"; | ||
126 | + }; | ||
127 | + 1D46C8AAAC9E59E360CC2838D3227E95 /* iOS */ = { | ||
128 | + isa = PBXGroup; | ||
129 | + children = ( | ||
130 | + 33B191A7CD5F1D4BA6167963BE6ECFE1 /* AVFoundation.framework */, | ||
131 | + 5DA23F9D788EEFAE7C7662FDC4D42A5E /* CoreImage.framework */, | ||
132 | + A944E2A381FC1C22728EC807559C4C86 /* Foundation.framework */, | ||
133 | + A6C7186A58209BD865768FEEECE45879 /* QuartzCore.framework */, | ||
134 | + ); | ||
135 | + name = iOS; | ||
136 | + sourceTree = "<group>"; | ||
137 | + }; | ||
41 | 24DA7987E049129D8347880A810DDBB1 /* Targets Support Files */ = { | 138 | 24DA7987E049129D8347880A810DDBB1 /* Targets Support Files */ = { |
42 | isa = PBXGroup; | 139 | isa = PBXGroup; |
43 | children = ( | 140 | children = ( |
... | @@ -46,6 +143,35 @@ | ... | @@ -46,6 +143,35 @@ |
46 | name = "Targets Support Files"; | 143 | name = "Targets Support Files"; |
47 | sourceTree = "<group>"; | 144 | sourceTree = "<group>"; |
48 | }; | 145 | }; |
146 | + 291D453EAC07BC54E13A98D15C6D526E /* RSBarcodes_Swift */ = { | ||
147 | + isa = PBXGroup; | ||
148 | + children = ( | ||
149 | + 3BA7ECA7DEC0464AB14CEC8FB73C16DA /* ContextMaker.swift */, | ||
150 | + 2A7EAD43A1CD4D812852352204C3D1FD /* RSCode128Generator.swift */, | ||
151 | + A70EA7F4B9944D0F81ADE63C29F6B74A /* RSCode39Generator.swift */, | ||
152 | + F8B8044E2FEE81ADFF29C1084020BBEE /* RSCode39Mod43Generator.swift */, | ||
153 | + 214258C0DC11D5A201F9293FF484DD2E /* RSCode93Generator.swift */, | ||
154 | + F3AB8A056DF50685033466069E237A14 /* RSCodeDataMatrixGenerator.swift */, | ||
155 | + 55B7BBDDEABCF9D24B31EA0ADE75DFF3 /* RSCodeGenerator.swift */, | ||
156 | + 1B01FBA694263430A4BDB814D5211E16 /* RSCodeLayer.swift */, | ||
157 | + 858327FB4B5D770F80A8D44B7F52FE05 /* RSCodeReaderViewController.swift */, | ||
158 | + E3455E17394A5AB2F88546F52599FE8C /* RSCornersLayer.swift */, | ||
159 | + CD3AA69B1B0D500239BE47CA68349021 /* RSEANGenerator.swift */, | ||
160 | + 8BD0C3768A6D9F31A32D63DFF071C8BF /* RSExtendedCode39Generator.swift */, | ||
161 | + E107504D90AB42B9BC594C6722D0182A /* RSFocusMarkLayer.swift */, | ||
162 | + CDF9008817996E19632780D0A4BFB8B5 /* RSITF14Generator.swift */, | ||
163 | + CDDED3429B0E0BDC158E1EC36A226D29 /* RSITFGenerator.swift */, | ||
164 | + 680FDAB9088C5319CE20751DE30DEBCE /* RSUnifiedCodeGenerator.swift */, | ||
165 | + A8F77A025F8AD377874E5F3E19AE7C79 /* RSUnifiedCodeValidator.swift */, | ||
166 | + CE4AEAC7C2D6CCA5D47E35AEDB153D83 /* RSUPCEGenerator.swift */, | ||
167 | + 8BBA779B4FF00402FEC4985CF4A7B9BC /* StringExtension.swift */, | ||
168 | + 0568EC6DAF22B32CDD16856911FD4105 /* UIColorExtension.swift */, | ||
169 | + E61268093DAB9EBB123454DC1EE66301 /* Support Files */, | ||
170 | + ); | ||
171 | + name = RSBarcodes_Swift; | ||
172 | + path = RSBarcodes_Swift; | ||
173 | + sourceTree = "<group>"; | ||
174 | + }; | ||
49 | 2F2FA44F045F7F6CEBF00B29980DD5B9 /* Pods-WarplySDKFrameworkIOS */ = { | 175 | 2F2FA44F045F7F6CEBF00B29980DD5B9 /* Pods-WarplySDKFrameworkIOS */ = { |
50 | isa = PBXGroup; | 176 | isa = PBXGroup; |
51 | children = ( | 177 | children = ( |
... | @@ -62,66 +188,102 @@ | ... | @@ -62,66 +188,102 @@ |
62 | path = "Target Support Files/Pods-WarplySDKFrameworkIOS"; | 188 | path = "Target Support Files/Pods-WarplySDKFrameworkIOS"; |
63 | sourceTree = "<group>"; | 189 | sourceTree = "<group>"; |
64 | }; | 190 | }; |
65 | - 578452D2E740E91742655AC8F1636D1F /* iOS */ = { | 191 | + 59048A30E99D9FEF92A013044A75BDA4 /* Products */ = { |
66 | isa = PBXGroup; | 192 | isa = PBXGroup; |
67 | children = ( | 193 | children = ( |
68 | - 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */, | 194 | + F88D658AD0E099B29A131EF709CC6530 /* Pods-WarplySDKFrameworkIOS */, |
195 | + 33350D89813FDC0792B0D0B114B76A33 /* RSBarcodes_Swift */, | ||
69 | ); | 196 | ); |
70 | - name = iOS; | 197 | + name = Products; |
71 | sourceTree = "<group>"; | 198 | sourceTree = "<group>"; |
72 | }; | 199 | }; |
73 | - 8EB503099D7FD0818479753866675C2C /* Products */ = { | 200 | + BA4F31F07263C99FC76E66D632A59F09 /* Frameworks */ = { |
74 | isa = PBXGroup; | 201 | isa = PBXGroup; |
75 | children = ( | 202 | children = ( |
76 | - F88D658AD0E099B29A131EF709CC6530 /* Pods-WarplySDKFrameworkIOS */, | 203 | + 1D46C8AAAC9E59E360CC2838D3227E95 /* iOS */, |
77 | ); | 204 | ); |
78 | - name = Products; | 205 | + name = Frameworks; |
79 | sourceTree = "<group>"; | 206 | sourceTree = "<group>"; |
80 | }; | 207 | }; |
81 | CF1408CF629C7361332E53B88F7BD30C = { | 208 | CF1408CF629C7361332E53B88F7BD30C = { |
82 | isa = PBXGroup; | 209 | isa = PBXGroup; |
83 | children = ( | 210 | children = ( |
84 | 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, | 211 | 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, |
85 | - D210D550F4EA176C3123ED886F8F87F5 /* Frameworks */, | 212 | + BA4F31F07263C99FC76E66D632A59F09 /* Frameworks */, |
86 | - 8EB503099D7FD0818479753866675C2C /* Products */, | 213 | + 0EEA9E9906DE882E95DFF9F8E6FC0981 /* Pods */, |
214 | + 59048A30E99D9FEF92A013044A75BDA4 /* Products */, | ||
87 | 24DA7987E049129D8347880A810DDBB1 /* Targets Support Files */, | 215 | 24DA7987E049129D8347880A810DDBB1 /* Targets Support Files */, |
88 | ); | 216 | ); |
89 | sourceTree = "<group>"; | 217 | sourceTree = "<group>"; |
90 | }; | 218 | }; |
91 | - D210D550F4EA176C3123ED886F8F87F5 /* Frameworks */ = { | 219 | + E61268093DAB9EBB123454DC1EE66301 /* Support Files */ = { |
92 | isa = PBXGroup; | 220 | isa = PBXGroup; |
93 | children = ( | 221 | children = ( |
94 | - 578452D2E740E91742655AC8F1636D1F /* iOS */, | 222 | + CCFA91CFAC9A2A8C13929A50AB27327D /* RSBarcodes_Swift.modulemap */, |
223 | + E8C280F49295B1757C26C05F383F8638 /* RSBarcodes_Swift-dummy.m */, | ||
224 | + F5F3410744C4FAFD32980AF57D615CBF /* RSBarcodes_Swift-Info.plist */, | ||
225 | + 2363AF68813770FC1693F17099D7B4E2 /* RSBarcodes_Swift-prefix.pch */, | ||
226 | + D25478B57CA940F484DDFB8F5FF981A6 /* RSBarcodes_Swift-umbrella.h */, | ||
227 | + C8BDB1FBE63E1D9091638224544830C3 /* RSBarcodes_Swift.debug.xcconfig */, | ||
228 | + B898B8D01EB10CAD6EDFCEDAF24D96B0 /* RSBarcodes_Swift.release.xcconfig */, | ||
95 | ); | 229 | ); |
96 | - name = Frameworks; | 230 | + name = "Support Files"; |
231 | + path = "../Target Support Files/RSBarcodes_Swift"; | ||
97 | sourceTree = "<group>"; | 232 | sourceTree = "<group>"; |
98 | }; | 233 | }; |
99 | /* End PBXGroup section */ | 234 | /* End PBXGroup section */ |
100 | 235 | ||
101 | /* Begin PBXHeadersBuildPhase section */ | 236 | /* Begin PBXHeadersBuildPhase section */ |
102 | - 77C57494E927AF72D6D92A4313DA848C /* Headers */ = { | 237 | + 8003D17E34B31501DA58E80BCDD3B735 /* Headers */ = { |
103 | isa = PBXHeadersBuildPhase; | 238 | isa = PBXHeadersBuildPhase; |
104 | buildActionMask = 2147483647; | 239 | buildActionMask = 2147483647; |
105 | files = ( | 240 | files = ( |
106 | - 3CB94267BAAACA600E34164D0EE6A83D /* Pods-WarplySDKFrameworkIOS-umbrella.h in Headers */, | 241 | + 12565F53551E3F99FF1563B2EAB7245E /* Pods-WarplySDKFrameworkIOS-umbrella.h in Headers */, |
242 | + ); | ||
243 | + runOnlyForDeploymentPostprocessing = 0; | ||
244 | + }; | ||
245 | + D8F9BC9CEEADC306F65DAEE0D51E97F6 /* Headers */ = { | ||
246 | + isa = PBXHeadersBuildPhase; | ||
247 | + buildActionMask = 2147483647; | ||
248 | + files = ( | ||
249 | + E7FFBBC5AF2005FCA69393FACA0226D2 /* RSBarcodes_Swift-umbrella.h in Headers */, | ||
107 | ); | 250 | ); |
108 | runOnlyForDeploymentPostprocessing = 0; | 251 | runOnlyForDeploymentPostprocessing = 0; |
109 | }; | 252 | }; |
110 | /* End PBXHeadersBuildPhase section */ | 253 | /* End PBXHeadersBuildPhase section */ |
111 | 254 | ||
112 | /* Begin PBXNativeTarget section */ | 255 | /* Begin PBXNativeTarget section */ |
256 | + 3C896FA0C00DEA19240C4BFD2C54E0D3 /* RSBarcodes_Swift */ = { | ||
257 | + isa = PBXNativeTarget; | ||
258 | + buildConfigurationList = DDC8597B5950815FDB21A31838A57A46 /* Build configuration list for PBXNativeTarget "RSBarcodes_Swift" */; | ||
259 | + buildPhases = ( | ||
260 | + D8F9BC9CEEADC306F65DAEE0D51E97F6 /* Headers */, | ||
261 | + 03D1E9517320D9679EFBC218F816D98F /* Sources */, | ||
262 | + 87FCBCA369E651BD607E728CDCA04868 /* Frameworks */, | ||
263 | + 5FDE2AC8D134024ADBE75EC05AF21A39 /* Resources */, | ||
264 | + ); | ||
265 | + buildRules = ( | ||
266 | + ); | ||
267 | + dependencies = ( | ||
268 | + ); | ||
269 | + name = RSBarcodes_Swift; | ||
270 | + productName = RSBarcodes_Swift; | ||
271 | + productReference = 33350D89813FDC0792B0D0B114B76A33 /* RSBarcodes_Swift */; | ||
272 | + productType = "com.apple.product-type.framework"; | ||
273 | + }; | ||
113 | C6C64B3B320397CC1D8287CA8BA24255 /* Pods-WarplySDKFrameworkIOS */ = { | 274 | C6C64B3B320397CC1D8287CA8BA24255 /* Pods-WarplySDKFrameworkIOS */ = { |
114 | isa = PBXNativeTarget; | 275 | isa = PBXNativeTarget; |
115 | - buildConfigurationList = B6D2C4D3878A30AAAE8B97D80603A15F /* Build configuration list for PBXNativeTarget "Pods-WarplySDKFrameworkIOS" */; | 276 | + buildConfigurationList = 3BD3E3F547DE3AB21B87CE78CF4AF6FC /* Build configuration list for PBXNativeTarget "Pods-WarplySDKFrameworkIOS" */; |
116 | buildPhases = ( | 277 | buildPhases = ( |
117 | - 77C57494E927AF72D6D92A4313DA848C /* Headers */, | 278 | + 8003D17E34B31501DA58E80BCDD3B735 /* Headers */, |
118 | - 233E89DCFBC636797E64391823F82E66 /* Sources */, | 279 | + DE273A3288B18F1173C023D63E05BD2A /* Sources */, |
119 | - 7A4FE7AD3238E2ECE0F4F0627A5C84E2 /* Frameworks */, | 280 | + F727AFF969F4390DC15E578713711206 /* Frameworks */, |
120 | - 013DA7ACA280D19C3B86FF5DE72162D7 /* Resources */, | 281 | + DA4EA784E871E40BF62F5CB4D788372E /* Resources */, |
121 | ); | 282 | ); |
122 | buildRules = ( | 283 | buildRules = ( |
123 | ); | 284 | ); |
124 | dependencies = ( | 285 | dependencies = ( |
286 | + 7CF08AFC43F49E84FF110CD229ADB4B6 /* PBXTargetDependency */, | ||
125 | ); | 287 | ); |
126 | name = "Pods-WarplySDKFrameworkIOS"; | 288 | name = "Pods-WarplySDKFrameworkIOS"; |
127 | productName = Pods_WarplySDKFrameworkIOS; | 289 | productName = Pods_WarplySDKFrameworkIOS; |
... | @@ -146,17 +308,25 @@ | ... | @@ -146,17 +308,25 @@ |
146 | en, | 308 | en, |
147 | ); | 309 | ); |
148 | mainGroup = CF1408CF629C7361332E53B88F7BD30C; | 310 | mainGroup = CF1408CF629C7361332E53B88F7BD30C; |
149 | - productRefGroup = 8EB503099D7FD0818479753866675C2C /* Products */; | 311 | + productRefGroup = 59048A30E99D9FEF92A013044A75BDA4 /* Products */; |
150 | projectDirPath = ""; | 312 | projectDirPath = ""; |
151 | projectRoot = ""; | 313 | projectRoot = ""; |
152 | targets = ( | 314 | targets = ( |
153 | C6C64B3B320397CC1D8287CA8BA24255 /* Pods-WarplySDKFrameworkIOS */, | 315 | C6C64B3B320397CC1D8287CA8BA24255 /* Pods-WarplySDKFrameworkIOS */, |
316 | + 3C896FA0C00DEA19240C4BFD2C54E0D3 /* RSBarcodes_Swift */, | ||
154 | ); | 317 | ); |
155 | }; | 318 | }; |
156 | /* End PBXProject section */ | 319 | /* End PBXProject section */ |
157 | 320 | ||
158 | /* Begin PBXResourcesBuildPhase section */ | 321 | /* Begin PBXResourcesBuildPhase section */ |
159 | - 013DA7ACA280D19C3B86FF5DE72162D7 /* Resources */ = { | 322 | + 5FDE2AC8D134024ADBE75EC05AF21A39 /* Resources */ = { |
323 | + isa = PBXResourcesBuildPhase; | ||
324 | + buildActionMask = 2147483647; | ||
325 | + files = ( | ||
326 | + ); | ||
327 | + runOnlyForDeploymentPostprocessing = 0; | ||
328 | + }; | ||
329 | + DA4EA784E871E40BF62F5CB4D788372E /* Resources */ = { | ||
160 | isa = PBXResourcesBuildPhase; | 330 | isa = PBXResourcesBuildPhase; |
161 | buildActionMask = 2147483647; | 331 | buildActionMask = 2147483647; |
162 | files = ( | 332 | files = ( |
... | @@ -166,23 +336,58 @@ | ... | @@ -166,23 +336,58 @@ |
166 | /* End PBXResourcesBuildPhase section */ | 336 | /* End PBXResourcesBuildPhase section */ |
167 | 337 | ||
168 | /* Begin PBXSourcesBuildPhase section */ | 338 | /* Begin PBXSourcesBuildPhase section */ |
169 | - 233E89DCFBC636797E64391823F82E66 /* Sources */ = { | 339 | + 03D1E9517320D9679EFBC218F816D98F /* Sources */ = { |
170 | isa = PBXSourcesBuildPhase; | 340 | isa = PBXSourcesBuildPhase; |
171 | buildActionMask = 2147483647; | 341 | buildActionMask = 2147483647; |
172 | files = ( | 342 | files = ( |
173 | - 94CF3909D90B545F11886D2920E02763 /* Pods-WarplySDKFrameworkIOS-dummy.m in Sources */, | 343 | + 7DD2212D6D7B540985937C6930994BEA /* ContextMaker.swift in Sources */, |
344 | + D15FAF53AAD1789027D0E0EC27B46E82 /* RSBarcodes_Swift-dummy.m in Sources */, | ||
345 | + E05B0B3D85AD8264D06DD3404AAE0556 /* RSCode128Generator.swift in Sources */, | ||
346 | + 41E2817A8EF001F43FB61CFCE1457B4E /* RSCode39Generator.swift in Sources */, | ||
347 | + FD09BC74BDA6FCCA44092100E4D2CFF8 /* RSCode39Mod43Generator.swift in Sources */, | ||
348 | + 711E684F2D76C938CB35E2730E53B9CC /* RSCode93Generator.swift in Sources */, | ||
349 | + 39A13850C2B4154BEB6B1748ADC04201 /* RSCodeDataMatrixGenerator.swift in Sources */, | ||
350 | + B6234C50A73A62C42CDD5067C44663BA /* RSCodeGenerator.swift in Sources */, | ||
351 | + DC7CE7EBB97FBDE958725B1371F43E26 /* RSCodeLayer.swift in Sources */, | ||
352 | + D697AA0DB2FFFA2459ACC459F8CA8794 /* RSCodeReaderViewController.swift in Sources */, | ||
353 | + BC7E203C1F132BA3955B93BB02044830 /* RSCornersLayer.swift in Sources */, | ||
354 | + 85FAD53FB51819F05F3310CFABB2CCED /* RSEANGenerator.swift in Sources */, | ||
355 | + F278698D21257C92FE708357F26190D9 /* RSExtendedCode39Generator.swift in Sources */, | ||
356 | + 8C85310AC111885226FF0D25B41FAEF2 /* RSFocusMarkLayer.swift in Sources */, | ||
357 | + 6BD4D1A3C0962FFFE47B84FE981578A7 /* RSITF14Generator.swift in Sources */, | ||
358 | + 3C7289263FEAA4191FCFE25988044EBD /* RSITFGenerator.swift in Sources */, | ||
359 | + 9EB3F27C25339307654AB4B6F08CD966 /* RSUnifiedCodeGenerator.swift in Sources */, | ||
360 | + 27EA55D886E55816FA37C6BFFAA1EA4F /* RSUnifiedCodeValidator.swift in Sources */, | ||
361 | + 717423952F54594D6F8C8C1F1C1DF6DD /* RSUPCEGenerator.swift in Sources */, | ||
362 | + 3F72F4E3E3131D47CE00F3A554669E87 /* StringExtension.swift in Sources */, | ||
363 | + 1332AF6141E5F1FF39B19754800F8A5C /* UIColorExtension.swift in Sources */, | ||
364 | + ); | ||
365 | + runOnlyForDeploymentPostprocessing = 0; | ||
366 | + }; | ||
367 | + DE273A3288B18F1173C023D63E05BD2A /* Sources */ = { | ||
368 | + isa = PBXSourcesBuildPhase; | ||
369 | + buildActionMask = 2147483647; | ||
370 | + files = ( | ||
371 | + E2B6B038C8F1164C8981406BCE79AD90 /* Pods-WarplySDKFrameworkIOS-dummy.m in Sources */, | ||
174 | ); | 372 | ); |
175 | runOnlyForDeploymentPostprocessing = 0; | 373 | runOnlyForDeploymentPostprocessing = 0; |
176 | }; | 374 | }; |
177 | /* End PBXSourcesBuildPhase section */ | 375 | /* End PBXSourcesBuildPhase section */ |
178 | 376 | ||
377 | +/* Begin PBXTargetDependency section */ | ||
378 | + 7CF08AFC43F49E84FF110CD229ADB4B6 /* PBXTargetDependency */ = { | ||
379 | + isa = PBXTargetDependency; | ||
380 | + name = RSBarcodes_Swift; | ||
381 | + target = 3C896FA0C00DEA19240C4BFD2C54E0D3 /* RSBarcodes_Swift */; | ||
382 | + targetProxy = F14FCC47D788B5F25BEE8E788680E46E /* PBXContainerItemProxy */; | ||
383 | + }; | ||
384 | +/* End PBXTargetDependency section */ | ||
385 | + | ||
179 | /* Begin XCBuildConfiguration section */ | 386 | /* Begin XCBuildConfiguration section */ |
180 | - 385DCA88EB99A0BE9CDE5E09CB37622E /* Debug */ = { | 387 | + 42AE877A2EDC444BEDBF3A38CAE86007 /* Release */ = { |
181 | isa = XCBuildConfiguration; | 388 | isa = XCBuildConfiguration; |
182 | - baseConfigurationReference = 4C337411AA19624EC4CD26EC32EAD6EF /* Pods-WarplySDKFrameworkIOS.debug.xcconfig */; | 389 | + baseConfigurationReference = B898B8D01EB10CAD6EDFCEDAF24D96B0 /* RSBarcodes_Swift.release.xcconfig */; |
183 | buildSettings = { | 390 | buildSettings = { |
184 | - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; | ||
185 | - CLANG_ENABLE_OBJC_WEAK = NO; | ||
186 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; | 391 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; |
187 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; | 392 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; |
188 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; | 393 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; |
... | @@ -191,28 +396,28 @@ | ... | @@ -191,28 +396,28 @@ |
191 | DYLIB_COMPATIBILITY_VERSION = 1; | 396 | DYLIB_COMPATIBILITY_VERSION = 1; |
192 | DYLIB_CURRENT_VERSION = 1; | 397 | DYLIB_CURRENT_VERSION = 1; |
193 | DYLIB_INSTALL_NAME_BASE = "@rpath"; | 398 | DYLIB_INSTALL_NAME_BASE = "@rpath"; |
194 | - INFOPLIST_FILE = "Target Support Files/Pods-WarplySDKFrameworkIOS/Pods-WarplySDKFrameworkIOS-Info.plist"; | 399 | + GCC_PREFIX_HEADER = "Target Support Files/RSBarcodes_Swift/RSBarcodes_Swift-prefix.pch"; |
400 | + INFOPLIST_FILE = "Target Support Files/RSBarcodes_Swift/RSBarcodes_Swift-Info.plist"; | ||
195 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; | 401 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; |
196 | - IPHONEOS_DEPLOYMENT_TARGET = 13.0; | 402 | + IPHONEOS_DEPLOYMENT_TARGET = 9.0; |
197 | LD_RUNPATH_SEARCH_PATHS = ( | 403 | LD_RUNPATH_SEARCH_PATHS = ( |
198 | "$(inherited)", | 404 | "$(inherited)", |
199 | "@executable_path/Frameworks", | 405 | "@executable_path/Frameworks", |
200 | "@loader_path/Frameworks", | 406 | "@loader_path/Frameworks", |
201 | ); | 407 | ); |
202 | - MACH_O_TYPE = staticlib; | 408 | + MODULEMAP_FILE = "Target Support Files/RSBarcodes_Swift/RSBarcodes_Swift.modulemap"; |
203 | - MODULEMAP_FILE = "Target Support Files/Pods-WarplySDKFrameworkIOS/Pods-WarplySDKFrameworkIOS.modulemap"; | 409 | + PRODUCT_MODULE_NAME = RSBarcodes_Swift; |
204 | - OTHER_LDFLAGS = ""; | 410 | + PRODUCT_NAME = RSBarcodes_Swift; |
205 | - OTHER_LIBTOOLFLAGS = ""; | ||
206 | - PODS_ROOT = "$(SRCROOT)"; | ||
207 | - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; | ||
208 | - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; | ||
209 | SDKROOT = iphoneos; | 411 | SDKROOT = iphoneos; |
210 | SKIP_INSTALL = YES; | 412 | SKIP_INSTALL = YES; |
413 | + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; | ||
414 | + SWIFT_VERSION = 5.0; | ||
211 | TARGETED_DEVICE_FAMILY = "1,2"; | 415 | TARGETED_DEVICE_FAMILY = "1,2"; |
416 | + VALIDATE_PRODUCT = YES; | ||
212 | VERSIONING_SYSTEM = "apple-generic"; | 417 | VERSIONING_SYSTEM = "apple-generic"; |
213 | VERSION_INFO_PREFIX = ""; | 418 | VERSION_INFO_PREFIX = ""; |
214 | }; | 419 | }; |
215 | - name = Debug; | 420 | + name = Release; |
216 | }; | 421 | }; |
217 | 8DE5143C03248BB6CD542DE3963D6F3A /* Debug */ = { | 422 | 8DE5143C03248BB6CD542DE3963D6F3A /* Debug */ = { |
218 | isa = XCBuildConfiguration; | 423 | isa = XCBuildConfiguration; |
... | @@ -280,6 +485,78 @@ | ... | @@ -280,6 +485,78 @@ |
280 | }; | 485 | }; |
281 | name = Debug; | 486 | name = Debug; |
282 | }; | 487 | }; |
488 | + 8F5BA7EEE7D4789D6A8755AB3C3ACB5C /* Release */ = { | ||
489 | + isa = XCBuildConfiguration; | ||
490 | + baseConfigurationReference = F1E7484B07BAD976C8F38EC1B9D2783C /* Pods-WarplySDKFrameworkIOS.release.xcconfig */; | ||
491 | + buildSettings = { | ||
492 | + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; | ||
493 | + CLANG_ENABLE_OBJC_WEAK = NO; | ||
494 | + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; | ||
495 | + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; | ||
496 | + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; | ||
497 | + CURRENT_PROJECT_VERSION = 1; | ||
498 | + DEFINES_MODULE = YES; | ||
499 | + DYLIB_COMPATIBILITY_VERSION = 1; | ||
500 | + DYLIB_CURRENT_VERSION = 1; | ||
501 | + DYLIB_INSTALL_NAME_BASE = "@rpath"; | ||
502 | + INFOPLIST_FILE = "Target Support Files/Pods-WarplySDKFrameworkIOS/Pods-WarplySDKFrameworkIOS-Info.plist"; | ||
503 | + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; | ||
504 | + IPHONEOS_DEPLOYMENT_TARGET = 13.0; | ||
505 | + LD_RUNPATH_SEARCH_PATHS = ( | ||
506 | + "$(inherited)", | ||
507 | + "@executable_path/Frameworks", | ||
508 | + "@loader_path/Frameworks", | ||
509 | + ); | ||
510 | + MACH_O_TYPE = staticlib; | ||
511 | + MODULEMAP_FILE = "Target Support Files/Pods-WarplySDKFrameworkIOS/Pods-WarplySDKFrameworkIOS.modulemap"; | ||
512 | + OTHER_LDFLAGS = ""; | ||
513 | + OTHER_LIBTOOLFLAGS = ""; | ||
514 | + PODS_ROOT = "$(SRCROOT)"; | ||
515 | + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; | ||
516 | + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; | ||
517 | + SDKROOT = iphoneos; | ||
518 | + SKIP_INSTALL = YES; | ||
519 | + TARGETED_DEVICE_FAMILY = "1,2"; | ||
520 | + VALIDATE_PRODUCT = YES; | ||
521 | + VERSIONING_SYSTEM = "apple-generic"; | ||
522 | + VERSION_INFO_PREFIX = ""; | ||
523 | + }; | ||
524 | + name = Release; | ||
525 | + }; | ||
526 | + 96F1B90FA88DCC7B176CEA6B4AE70A12 /* Debug */ = { | ||
527 | + isa = XCBuildConfiguration; | ||
528 | + baseConfigurationReference = C8BDB1FBE63E1D9091638224544830C3 /* RSBarcodes_Swift.debug.xcconfig */; | ||
529 | + buildSettings = { | ||
530 | + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; | ||
531 | + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; | ||
532 | + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; | ||
533 | + CURRENT_PROJECT_VERSION = 1; | ||
534 | + DEFINES_MODULE = YES; | ||
535 | + DYLIB_COMPATIBILITY_VERSION = 1; | ||
536 | + DYLIB_CURRENT_VERSION = 1; | ||
537 | + DYLIB_INSTALL_NAME_BASE = "@rpath"; | ||
538 | + GCC_PREFIX_HEADER = "Target Support Files/RSBarcodes_Swift/RSBarcodes_Swift-prefix.pch"; | ||
539 | + INFOPLIST_FILE = "Target Support Files/RSBarcodes_Swift/RSBarcodes_Swift-Info.plist"; | ||
540 | + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; | ||
541 | + IPHONEOS_DEPLOYMENT_TARGET = 9.0; | ||
542 | + LD_RUNPATH_SEARCH_PATHS = ( | ||
543 | + "$(inherited)", | ||
544 | + "@executable_path/Frameworks", | ||
545 | + "@loader_path/Frameworks", | ||
546 | + ); | ||
547 | + MODULEMAP_FILE = "Target Support Files/RSBarcodes_Swift/RSBarcodes_Swift.modulemap"; | ||
548 | + PRODUCT_MODULE_NAME = RSBarcodes_Swift; | ||
549 | + PRODUCT_NAME = RSBarcodes_Swift; | ||
550 | + SDKROOT = iphoneos; | ||
551 | + SKIP_INSTALL = YES; | ||
552 | + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; | ||
553 | + SWIFT_VERSION = 5.0; | ||
554 | + TARGETED_DEVICE_FAMILY = "1,2"; | ||
555 | + VERSIONING_SYSTEM = "apple-generic"; | ||
556 | + VERSION_INFO_PREFIX = ""; | ||
557 | + }; | ||
558 | + name = Debug; | ||
559 | + }; | ||
283 | 9E406C6AAF85E580207CD97B0044DEAB /* Release */ = { | 560 | 9E406C6AAF85E580207CD97B0044DEAB /* Release */ = { |
284 | isa = XCBuildConfiguration; | 561 | isa = XCBuildConfiguration; |
285 | buildSettings = { | 562 | buildSettings = { |
... | @@ -342,9 +619,9 @@ | ... | @@ -342,9 +619,9 @@ |
342 | }; | 619 | }; |
343 | name = Release; | 620 | name = Release; |
344 | }; | 621 | }; |
345 | - D7DA3D63A4897FAAB799794E8BE3B283 /* Release */ = { | 622 | + BEB120E9FCD27FC06CFBB5DEFB56A14B /* Debug */ = { |
346 | isa = XCBuildConfiguration; | 623 | isa = XCBuildConfiguration; |
347 | - baseConfigurationReference = F1E7484B07BAD976C8F38EC1B9D2783C /* Pods-WarplySDKFrameworkIOS.release.xcconfig */; | 624 | + baseConfigurationReference = 4C337411AA19624EC4CD26EC32EAD6EF /* Pods-WarplySDKFrameworkIOS.debug.xcconfig */; |
348 | buildSettings = { | 625 | buildSettings = { |
349 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; | 626 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; |
350 | CLANG_ENABLE_OBJC_WEAK = NO; | 627 | CLANG_ENABLE_OBJC_WEAK = NO; |
... | @@ -374,15 +651,23 @@ | ... | @@ -374,15 +651,23 @@ |
374 | SDKROOT = iphoneos; | 651 | SDKROOT = iphoneos; |
375 | SKIP_INSTALL = YES; | 652 | SKIP_INSTALL = YES; |
376 | TARGETED_DEVICE_FAMILY = "1,2"; | 653 | TARGETED_DEVICE_FAMILY = "1,2"; |
377 | - VALIDATE_PRODUCT = YES; | ||
378 | VERSIONING_SYSTEM = "apple-generic"; | 654 | VERSIONING_SYSTEM = "apple-generic"; |
379 | VERSION_INFO_PREFIX = ""; | 655 | VERSION_INFO_PREFIX = ""; |
380 | }; | 656 | }; |
381 | - name = Release; | 657 | + name = Debug; |
382 | }; | 658 | }; |
383 | /* End XCBuildConfiguration section */ | 659 | /* End XCBuildConfiguration section */ |
384 | 660 | ||
385 | /* Begin XCConfigurationList section */ | 661 | /* Begin XCConfigurationList section */ |
662 | + 3BD3E3F547DE3AB21B87CE78CF4AF6FC /* Build configuration list for PBXNativeTarget "Pods-WarplySDKFrameworkIOS" */ = { | ||
663 | + isa = XCConfigurationList; | ||
664 | + buildConfigurations = ( | ||
665 | + BEB120E9FCD27FC06CFBB5DEFB56A14B /* Debug */, | ||
666 | + 8F5BA7EEE7D4789D6A8755AB3C3ACB5C /* Release */, | ||
667 | + ); | ||
668 | + defaultConfigurationIsVisible = 0; | ||
669 | + defaultConfigurationName = Release; | ||
670 | + }; | ||
386 | 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { | 671 | 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { |
387 | isa = XCConfigurationList; | 672 | isa = XCConfigurationList; |
388 | buildConfigurations = ( | 673 | buildConfigurations = ( |
... | @@ -392,11 +677,11 @@ | ... | @@ -392,11 +677,11 @@ |
392 | defaultConfigurationIsVisible = 0; | 677 | defaultConfigurationIsVisible = 0; |
393 | defaultConfigurationName = Release; | 678 | defaultConfigurationName = Release; |
394 | }; | 679 | }; |
395 | - B6D2C4D3878A30AAAE8B97D80603A15F /* Build configuration list for PBXNativeTarget "Pods-WarplySDKFrameworkIOS" */ = { | 680 | + DDC8597B5950815FDB21A31838A57A46 /* Build configuration list for PBXNativeTarget "RSBarcodes_Swift" */ = { |
396 | isa = XCConfigurationList; | 681 | isa = XCConfigurationList; |
397 | buildConfigurations = ( | 682 | buildConfigurations = ( |
398 | - 385DCA88EB99A0BE9CDE5E09CB37622E /* Debug */, | 683 | + 96F1B90FA88DCC7B176CEA6B4AE70A12 /* Debug */, |
399 | - D7DA3D63A4897FAAB799794E8BE3B283 /* Release */, | 684 | + 42AE877A2EDC444BEDBF3A38CAE86007 /* Release */, |
400 | ); | 685 | ); |
401 | defaultConfigurationIsVisible = 0; | 686 | defaultConfigurationIsVisible = 0; |
402 | defaultConfigurationName = Release; | 687 | defaultConfigurationName = Release; | ... | ... |
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 | +// RSCode128Generator.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 enum RSCode128GeneratorCodeTable: Int { | ||
12 | + case auto = 0 | ||
13 | + case a, b, c | ||
14 | +} | ||
15 | + | ||
16 | +// http://www.barcodeisland.com/code128.phtml | ||
17 | +// http://courses.cs.washington.edu/courses/cse370/01au/minirproject/BarcodeBattlers/barcodes.html | ||
18 | +open class RSCode128Generator: RSAbstractCodeGenerator, RSCheckDigitGenerator { | ||
19 | + class RSCode128GeneratorAutoCodeTable { | ||
20 | + var startCodeTable = RSCode128GeneratorCodeTable.auto | ||
21 | + var sequence:Array<Int> = [] | ||
22 | + } | ||
23 | + | ||
24 | + var codeTable: RSCode128GeneratorCodeTable | ||
25 | + var codeTableSize: Int | ||
26 | + var autoCodeTable: RSCode128GeneratorAutoCodeTable | ||
27 | + | ||
28 | + public init(codeTable:RSCode128GeneratorCodeTable) { | ||
29 | + self.codeTable = codeTable | ||
30 | + self.codeTableSize = CODE128_CHARACTER_ENCODINGS.count | ||
31 | + self.autoCodeTable = RSCode128GeneratorAutoCodeTable() | ||
32 | + } | ||
33 | + | ||
34 | + public convenience override init() { | ||
35 | + self.init(codeTable: .auto) | ||
36 | + } | ||
37 | + | ||
38 | + func startCodeTableValue(_ startCodeTable: RSCode128GeneratorCodeTable) -> Int { | ||
39 | + switch self.autoCodeTable.startCodeTable { | ||
40 | + case .a: | ||
41 | + return self.codeTableSize - 4 | ||
42 | + case .b: | ||
43 | + return self.codeTableSize - 3 | ||
44 | + case .c: | ||
45 | + return self.codeTableSize - 2 | ||
46 | + default: | ||
47 | + switch startCodeTable { | ||
48 | + case .a: | ||
49 | + return self.codeTableSize - 4 | ||
50 | + case .b: | ||
51 | + return self.codeTableSize - 3 | ||
52 | + case .c: | ||
53 | + return self.codeTableSize - 2 | ||
54 | + default: | ||
55 | + return 0 | ||
56 | + } | ||
57 | + } | ||
58 | + } | ||
59 | + | ||
60 | + func middleCodeTableValue(_ codeTable:RSCode128GeneratorCodeTable) -> Int { | ||
61 | + switch codeTable { | ||
62 | + case .a: | ||
63 | + return self.codeTableSize - 6 | ||
64 | + case .b: | ||
65 | + return self.codeTableSize - 7 | ||
66 | + case .c: | ||
67 | + return self.codeTableSize - 8 | ||
68 | + default: | ||
69 | + return 0 | ||
70 | + } | ||
71 | + } | ||
72 | + | ||
73 | + func calculateContinousDigits(_ contents:String, defaultCodeTable:RSCode128GeneratorCodeTable, range:Range<Int>) { | ||
74 | + var isFinished = false | ||
75 | + if range.upperBound == contents.length() { | ||
76 | + isFinished = true | ||
77 | + } | ||
78 | + | ||
79 | + let length = range.upperBound - range.lowerBound | ||
80 | + if (range.lowerBound == 0 && length >= 4) | ||
81 | + || (range.lowerBound > 0 && length >= 6) { | ||
82 | + var isOrphanDigitUsed = false | ||
83 | + // Use START C when continous digits are found from range.location == 0 | ||
84 | + if range.lowerBound == 0 { | ||
85 | + self.autoCodeTable.startCodeTable = .c | ||
86 | + } else { | ||
87 | + if length % 2 == 1 { | ||
88 | + let digitValue = CODE128_ALPHABET_STRING.location(contents[range.lowerBound]) | ||
89 | + self.autoCodeTable.sequence.append(digitValue) | ||
90 | + isOrphanDigitUsed = true | ||
91 | + } | ||
92 | + self.autoCodeTable.sequence.append(self.middleCodeTableValue(.c)) | ||
93 | + } | ||
94 | + | ||
95 | + // Insert all xx combinations | ||
96 | + for i in 0..<length / 2 { | ||
97 | + let startIndex = range.lowerBound + i * 2 | ||
98 | + let digitValue = Int(contents.substring(isOrphanDigitUsed ? startIndex + 1 : startIndex, length: 2))! | ||
99 | + self.autoCodeTable.sequence.append(digitValue) | ||
100 | + } | ||
101 | + | ||
102 | + if (length % 2 == 1 && !isOrphanDigitUsed) || !isFinished { | ||
103 | + self.autoCodeTable.sequence.append(self.middleCodeTableValue(defaultCodeTable)) | ||
104 | + } | ||
105 | + | ||
106 | + if length % 2 == 1 && !isOrphanDigitUsed { | ||
107 | + let digitValue = CODE128_ALPHABET_STRING.location(contents[range.upperBound - 1]) | ||
108 | + self.autoCodeTable.sequence.append(digitValue) | ||
109 | + } | ||
110 | + | ||
111 | + if !isFinished { | ||
112 | + let characterValue = CODE128_ALPHABET_STRING.location(contents[range.upperBound]) | ||
113 | + self.autoCodeTable.sequence.append(characterValue) | ||
114 | + } | ||
115 | + } else { | ||
116 | + for i in range.lowerBound...(isFinished ? range.upperBound - 1 : range.upperBound) { | ||
117 | + let characterValue = CODE128_ALPHABET_STRING.location(contents[i]) | ||
118 | + self.autoCodeTable.sequence.append(characterValue) | ||
119 | + } | ||
120 | + } | ||
121 | + } | ||
122 | + | ||
123 | + func calculateAutoCodeTable(_ contents:String) { | ||
124 | + if self.codeTable == .auto { | ||
125 | + // Select the short code table A as default code table | ||
126 | + var defaultCodeTable: RSCode128GeneratorCodeTable = .a | ||
127 | + | ||
128 | + // Determine whether to use code table B | ||
129 | + if let CODE128_ALPHABET_STRING_A = CODE128_ALPHABET_STRING.substring(0, length: 64) { | ||
130 | + for i in 0..<contents.length() { | ||
131 | + if CODE128_ALPHABET_STRING_A.location(contents[i]) == NSNotFound | ||
132 | + && defaultCodeTable == .a { | ||
133 | + defaultCodeTable = .b | ||
134 | + break | ||
135 | + } | ||
136 | + } | ||
137 | + } | ||
138 | + | ||
139 | + var continousDigitsStartIndex:Int = NSNotFound | ||
140 | + for i in 0..<contents.length() { | ||
141 | + var continousDigitsRange:Range<Int> = 0..<0 | ||
142 | + if let character = contents[i] { | ||
143 | + if DIGITS_STRING.location(character) == NSNotFound { | ||
144 | + // Non digit found | ||
145 | + if continousDigitsStartIndex != NSNotFound { | ||
146 | + continousDigitsRange = continousDigitsStartIndex..<i | ||
147 | + } else { | ||
148 | + let characterValue = CODE128_ALPHABET_STRING.location(character) | ||
149 | + self.autoCodeTable.sequence.append(characterValue) | ||
150 | + } | ||
151 | + } else { | ||
152 | + // Digit found | ||
153 | + if continousDigitsStartIndex == NSNotFound { | ||
154 | + continousDigitsStartIndex = i | ||
155 | + } | ||
156 | + if continousDigitsStartIndex != NSNotFound && i == contents.length() - 1 { | ||
157 | + continousDigitsRange = continousDigitsStartIndex..<(i + 1) | ||
158 | + } | ||
159 | + } | ||
160 | + | ||
161 | + if continousDigitsRange.upperBound - continousDigitsRange.lowerBound != 0 { | ||
162 | + self.calculateContinousDigits(contents, defaultCodeTable: defaultCodeTable, range: continousDigitsRange) | ||
163 | + continousDigitsStartIndex = NSNotFound | ||
164 | + } | ||
165 | + } | ||
166 | + } | ||
167 | + | ||
168 | + if self.autoCodeTable.startCodeTable == .auto { | ||
169 | + self.autoCodeTable.startCodeTable = defaultCodeTable | ||
170 | + } | ||
171 | + } | ||
172 | + } | ||
173 | + | ||
174 | + func encodeCharacterString(_ characterString:String) -> String { | ||
175 | + return CODE128_CHARACTER_ENCODINGS[CODE128_ALPHABET_STRING.location(characterString)] | ||
176 | + } | ||
177 | + | ||
178 | + override open func initiator() -> String { | ||
179 | + switch self.codeTable { | ||
180 | + case .auto: | ||
181 | + return CODE128_CHARACTER_ENCODINGS[self.startCodeTableValue(self.autoCodeTable.startCodeTable)] | ||
182 | + default: | ||
183 | + return CODE128_CHARACTER_ENCODINGS[self.startCodeTableValue(self.codeTable)] | ||
184 | + } | ||
185 | + } | ||
186 | + | ||
187 | + override open func terminator() -> String { | ||
188 | + return CODE128_CHARACTER_ENCODINGS[self.codeTableSize - 1] + "11" | ||
189 | + } | ||
190 | + | ||
191 | + override open func isValid(_ contents: String) -> Bool { | ||
192 | + if contents.length() > 0 { | ||
193 | + for i in 0..<contents.length() { | ||
194 | + if CODE128_ALPHABET_STRING.location(contents[i]) == NSNotFound { | ||
195 | + return false | ||
196 | + } | ||
197 | + } | ||
198 | + | ||
199 | + switch self.codeTable { | ||
200 | + case .auto: | ||
201 | + self.calculateAutoCodeTable(contents) | ||
202 | + fallthrough | ||
203 | + case .b: | ||
204 | + return true | ||
205 | + case .a: | ||
206 | + if let CODE128_ALPHABET_STRING_A = CODE128_ALPHABET_STRING.substring(0, length: 64) { | ||
207 | + for i in 0..<contents.length() { | ||
208 | + if CODE128_ALPHABET_STRING_A.location(contents[i]) == NSNotFound { | ||
209 | + return false | ||
210 | + } | ||
211 | + } | ||
212 | + } | ||
213 | + return true | ||
214 | + case .c: | ||
215 | + if contents.length() % 2 == 0 && contents.isNumeric() { | ||
216 | + return true | ||
217 | + } | ||
218 | + return false | ||
219 | + } | ||
220 | + } | ||
221 | + return false | ||
222 | + } | ||
223 | + | ||
224 | + override open func barcode(_ contents: String) -> String { | ||
225 | + var barcode = "" | ||
226 | + switch self.codeTable { | ||
227 | + case .auto: | ||
228 | + for i in 0..<self.autoCodeTable.sequence.count { | ||
229 | + barcode += CODE128_CHARACTER_ENCODINGS[self.autoCodeTable.sequence[i]] | ||
230 | + } | ||
231 | + case .a, .b: | ||
232 | + for i in 0..<contents.length() { | ||
233 | + barcode += self.encodeCharacterString(contents[i]) | ||
234 | + } | ||
235 | + case .c: | ||
236 | + for i in 0..<contents.length() { | ||
237 | + if i % 2 == 1 { | ||
238 | + continue | ||
239 | + } else { | ||
240 | + let value = Int(contents.substring(i, length: 2))! | ||
241 | + barcode += CODE128_CHARACTER_ENCODINGS[value] | ||
242 | + } | ||
243 | + } | ||
244 | + } | ||
245 | + | ||
246 | + barcode += self.checkDigit(contents) | ||
247 | + return barcode | ||
248 | + } | ||
249 | + | ||
250 | + // MARK: RSCheckDigitGenerator | ||
251 | + | ||
252 | + open func checkDigit(_ contents: String) -> String { | ||
253 | + var sum = 0 | ||
254 | + switch self.codeTable { | ||
255 | + case .auto: | ||
256 | + sum += self.startCodeTableValue(self.autoCodeTable.startCodeTable) | ||
257 | + for i in 0..<self.autoCodeTable.sequence.count { | ||
258 | + sum += self.autoCodeTable.sequence[i] * (i + 1) | ||
259 | + } | ||
260 | + case .a: | ||
261 | + sum = -1 // START A = self.codeTableSize - 4 = START B - 1 | ||
262 | + fallthrough | ||
263 | + case .b: | ||
264 | + sum += self.codeTableSize - 3 // START B | ||
265 | + for i in 0..<contents.length() { | ||
266 | + let characterValue = CODE128_ALPHABET_STRING.location(contents[i]) | ||
267 | + sum += characterValue * (i + 1) | ||
268 | + } | ||
269 | + case .c: | ||
270 | + sum += self.codeTableSize - 2 // START C | ||
271 | + for i in 0..<contents.length() { | ||
272 | + if i % 2 == 1 { | ||
273 | + continue | ||
274 | + } else { | ||
275 | + let value = Int(contents.substring(i, length: 2))! | ||
276 | + sum += value * (i / 2 + 1) | ||
277 | + } | ||
278 | + } | ||
279 | + } | ||
280 | + return CODE128_CHARACTER_ENCODINGS[sum % 103] | ||
281 | + } | ||
282 | + | ||
283 | + let CODE128_ALPHABET_STRING = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'abcdefghijklmnopqrstuvwxyz{|}~" | ||
284 | + | ||
285 | + let CODE128_CHARACTER_ENCODINGS = [ | ||
286 | + "11011001100", | ||
287 | + "11001101100", | ||
288 | + "11001100110", | ||
289 | + "10010011000", | ||
290 | + "10010001100", | ||
291 | + "10001001100", | ||
292 | + "10011001000", | ||
293 | + "10011000100", | ||
294 | + "10001100100", | ||
295 | + "11001001000", | ||
296 | + "11001000100", | ||
297 | + "11000100100", | ||
298 | + "10110011100", | ||
299 | + "10011011100", | ||
300 | + "10011001110", | ||
301 | + "10111001100", | ||
302 | + "10011101100", | ||
303 | + "10011100110", | ||
304 | + "11001110010", | ||
305 | + "11001011100", | ||
306 | + "11001001110", | ||
307 | + "11011100100", | ||
308 | + "11001110100", | ||
309 | + "11101101110", | ||
310 | + "11101001100", | ||
311 | + "11100101100", | ||
312 | + "11100100110", | ||
313 | + "11101100100", | ||
314 | + "11100110100", | ||
315 | + "11100110010", | ||
316 | + "11011011000", | ||
317 | + "11011000110", | ||
318 | + "11000110110", | ||
319 | + "10100011000", | ||
320 | + "10001011000", | ||
321 | + "10001000110", | ||
322 | + "10110001000", | ||
323 | + "10001101000", | ||
324 | + "10001100010", | ||
325 | + "11010001000", | ||
326 | + "11000101000", | ||
327 | + "11000100010", | ||
328 | + "10110111000", | ||
329 | + "10110001110", | ||
330 | + "10001101110", | ||
331 | + "10111011000", | ||
332 | + "10111000110", | ||
333 | + "10001110110", | ||
334 | + "11101110110", | ||
335 | + "11010001110", | ||
336 | + "11000101110", | ||
337 | + "11011101000", | ||
338 | + "11011100010", | ||
339 | + "11011101110", | ||
340 | + "11101011000", | ||
341 | + "11101000110", | ||
342 | + "11100010110", | ||
343 | + "11101101000", | ||
344 | + "11101100010", | ||
345 | + "11100011010", | ||
346 | + "11101111010", | ||
347 | + "11001000010", | ||
348 | + "11110001010", | ||
349 | + "10100110000", // 64 | ||
350 | + // Visible character encoding for code table A ended. | ||
351 | + "10100001100", | ||
352 | + "10010110000", | ||
353 | + "10010000110", | ||
354 | + "10000101100", | ||
355 | + "10000100110", | ||
356 | + "10110010000", | ||
357 | + "10110000100", | ||
358 | + "10011010000", | ||
359 | + "10011000010", | ||
360 | + "10000110100", | ||
361 | + "10000110010", | ||
362 | + "11000010010", | ||
363 | + "11001010000", | ||
364 | + "11110111010", | ||
365 | + "11000010100", | ||
366 | + "10001111010", | ||
367 | + "10100111100", | ||
368 | + "10010111100", | ||
369 | + "10010011110", | ||
370 | + "10111100100", | ||
371 | + "10011110100", | ||
372 | + "10011110010", | ||
373 | + "11110100100", | ||
374 | + "11110010100", | ||
375 | + "11110010010", | ||
376 | + "11011011110", | ||
377 | + "11011110110", | ||
378 | + "11110110110", | ||
379 | + "10101111000", | ||
380 | + "10100011110", | ||
381 | + "10001011110", | ||
382 | + // Visible character encoding for code table B ended. | ||
383 | + "10111101000", | ||
384 | + "10111100010", | ||
385 | + "11110101000", | ||
386 | + "11110100010", | ||
387 | + "10111011110", // to C from A, B (size - 8) | ||
388 | + "10111101110", // to B from A, C (size - 7) | ||
389 | + "11101011110", // to A from B, C (size - 6) | ||
390 | + "11110101110", | ||
391 | + "11010000100", // START A (size - 4) | ||
392 | + "11010010000", // START B (size - 3) | ||
393 | + "11010011100", // START C (size - 2) | ||
394 | + "11000111010" // STOP (size - 1) | ||
395 | + ] | ||
396 | +} |
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 | +// RSCodeGenerator.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 | +import CoreImage | ||
13 | + | ||
14 | +let DIGITS_STRING = "0123456789" | ||
15 | +let BARCODE_DEFAULT_HEIGHT = 28 | ||
16 | + | ||
17 | +// Controls the amount of additional data encoded in the output image to provide error correction. | ||
18 | +// Higher levels of error correction result in larger output images but allow larger areas of the code to be damaged or obscured without. | ||
19 | +public enum InputCorrectionLevel: String { | ||
20 | + case Low = "L" // 7% | ||
21 | + case Medium = "M" // 15% default | ||
22 | + case Quarter = "Q" // 25% | ||
23 | + case High = "H" // 30% | ||
24 | +} | ||
25 | + | ||
26 | +// Code generators are required to provide these two functions. | ||
27 | +public protocol RSCodeGenerator { | ||
28 | + /** The fill (background) color of the generated barcode. */ | ||
29 | + var fillColor: UIColor {get set} | ||
30 | + | ||
31 | + /** The stroke color of the generated barcode. */ | ||
32 | + var strokeColor: UIColor {get set} | ||
33 | + | ||
34 | + /** Check whether the given contents are valid. */ | ||
35 | + func isValid(_ contents:String) -> Bool | ||
36 | + | ||
37 | + /** Generate code image using the given machine readable code object and correction level. */ | ||
38 | + func generateCode(_ machineReadableCodeObject:AVMetadataMachineReadableCodeObject, inputCorrectionLevel:InputCorrectionLevel, targetSize: CGSize?) -> UIImage? | ||
39 | + | ||
40 | + /** Generate code image using the given machine readable code object. */ | ||
41 | + func generateCode(_ machineReadableCodeObject:AVMetadataMachineReadableCodeObject, targetSize: CGSize?) -> UIImage? | ||
42 | + | ||
43 | + /** Generate code image using the given machine readable code object type, contents and correction level. */ | ||
44 | + func generateCode(_ contents:String, inputCorrectionLevel:InputCorrectionLevel, machineReadableCodeObjectType:String, targetSize: CGSize?) -> UIImage? | ||
45 | + | ||
46 | + /** Generate code image using the given machine readable code object type and contents. */ | ||
47 | + func generateCode(_ contents:String, machineReadableCodeObjectType:String, targetSize: CGSize?) -> UIImage? | ||
48 | +} | ||
49 | + | ||
50 | +// Check digit are not required for all code generators. | ||
51 | +// UPC-E is using check digit to valid the contents to be encoded. | ||
52 | +// Code39Mod43, Code93 and Code128 is using check digit to encode barcode. | ||
53 | +public protocol RSCheckDigitGenerator { | ||
54 | + func checkDigit(_ contents:String) -> String | ||
55 | +} | ||
56 | + | ||
57 | +// Abstract code generator, provides default functions for validations and generations. | ||
58 | +open class RSAbstractCodeGenerator : RSCodeGenerator { | ||
59 | + | ||
60 | + open var fillColor: UIColor = UIColor.white | ||
61 | + open var strokeColor: UIColor = UIColor.black | ||
62 | + | ||
63 | + // Check whether the given contents are valid. | ||
64 | + open func isValid(_ contents:String) -> Bool { | ||
65 | + let length = contents.length() | ||
66 | + if length > 0 { | ||
67 | + for i in 0..<length { | ||
68 | + if !DIGITS_STRING.contains(contents[i]) { | ||
69 | + return false | ||
70 | + } | ||
71 | + } | ||
72 | + return true | ||
73 | + } | ||
74 | + return false | ||
75 | + } | ||
76 | + | ||
77 | + // Barcode initiator, subclass should return its own value. | ||
78 | + open func initiator() -> String { | ||
79 | + return "" | ||
80 | + } | ||
81 | + | ||
82 | + // Barcode terminator, subclass should return its own value. | ||
83 | + open func terminator() -> String { | ||
84 | + return "" | ||
85 | + } | ||
86 | + | ||
87 | + // Barcode content, subclass should return its own value. | ||
88 | + open func barcode(_ contents:String) -> String { | ||
89 | + return "" | ||
90 | + } | ||
91 | + | ||
92 | + // Composer for combining barcode initiator, contents, terminator together. | ||
93 | + func completeBarcode(_ barcode:String) -> String { | ||
94 | + return self.initiator() + barcode + self.terminator() | ||
95 | + } | ||
96 | + | ||
97 | + // Drawer for completed barcode. | ||
98 | + func drawCompleteBarcode(_ completeBarcode:String, targetSize: CGSize? = nil) -> UIImage? { | ||
99 | + let length:Int = completeBarcode.length() | ||
100 | + if length <= 0 { | ||
101 | + return nil | ||
102 | + } | ||
103 | + | ||
104 | + // Values taken from CIImage generated AVMetadataObjectTypePDF417Code type image | ||
105 | + // Top spacing = 1.5 | ||
106 | + // Bottom spacing = 2 | ||
107 | + // Left & right spacing = 2 | ||
108 | + let width = length + 4 | ||
109 | + // Calculate the correct aspect ratio, so that the resulting image can be resized to the target size | ||
110 | + var height = BARCODE_DEFAULT_HEIGHT | ||
111 | + if let targetSize = targetSize { | ||
112 | + height = Int(targetSize.height / targetSize.width * CGFloat(width)) | ||
113 | + } | ||
114 | + let size = CGSize(width: CGFloat(width), height: CGFloat(height)) | ||
115 | + UIGraphicsBeginImageContextWithOptions(size, false, 0) | ||
116 | + if let context = UIGraphicsGetCurrentContext() { | ||
117 | + context.setShouldAntialias(false) | ||
118 | + | ||
119 | + self.fillColor.setFill() | ||
120 | + self.strokeColor.setStroke() | ||
121 | + | ||
122 | + context.fill(CGRect(x: 0, y: 0, width: size.width, height: size.height)) | ||
123 | + context.setLineWidth(1) | ||
124 | + | ||
125 | + for i in 0..<length { | ||
126 | + if completeBarcode[i] == "1" { | ||
127 | + let x = i + (2 + 1) | ||
128 | + context.move(to: CGPoint(x: CGFloat(x), y: 1.5)) | ||
129 | + context.addLine(to: CGPoint(x: CGFloat(x), y: size.height - 2)) | ||
130 | + } | ||
131 | + } | ||
132 | + context.drawPath(using: CGPathDrawingMode.fillStroke) | ||
133 | + let barcode = UIGraphicsGetImageFromCurrentImageContext() | ||
134 | + UIGraphicsEndImageContext() | ||
135 | + | ||
136 | + if let targetSize = targetSize, let barcode = barcode { | ||
137 | + return RSAbstractCodeGenerator.resizeImage(barcode, targetSize: targetSize, contentMode: UIView.ContentMode.bottomRight) | ||
138 | + } | ||
139 | + | ||
140 | + return barcode | ||
141 | + } else { | ||
142 | + return nil | ||
143 | + } | ||
144 | + } | ||
145 | + | ||
146 | + // RSCodeGenerator | ||
147 | + | ||
148 | + open func generateCode(_ machineReadableCodeObject:AVMetadataMachineReadableCodeObject, inputCorrectionLevel: InputCorrectionLevel, targetSize: CGSize? = nil) -> UIImage? { | ||
149 | + return self.generateCode(machineReadableCodeObject.stringValue!, inputCorrectionLevel: inputCorrectionLevel, machineReadableCodeObjectType: machineReadableCodeObject.type.rawValue, targetSize: targetSize) | ||
150 | + } | ||
151 | + | ||
152 | + open func generateCode(_ machineReadableCodeObject:AVMetadataMachineReadableCodeObject, targetSize: CGSize? = nil) -> UIImage? { | ||
153 | + return self.generateCode(machineReadableCodeObject, inputCorrectionLevel: .Medium, targetSize: targetSize) | ||
154 | + } | ||
155 | + | ||
156 | + open func generateCode(_ contents:String, inputCorrectionLevel:InputCorrectionLevel, machineReadableCodeObjectType:String, targetSize: CGSize? = nil) -> UIImage? { | ||
157 | + if self.isValid(contents) { | ||
158 | + return self.drawCompleteBarcode(self.completeBarcode(self.barcode(contents)), targetSize: targetSize) | ||
159 | + } | ||
160 | + return nil | ||
161 | + } | ||
162 | + | ||
163 | + open func generateCode(_ contents:String, machineReadableCodeObjectType:String, targetSize: CGSize? = nil) -> UIImage? { | ||
164 | + return self.generateCode(contents, inputCorrectionLevel: .Medium, machineReadableCodeObjectType: machineReadableCodeObjectType, targetSize: targetSize) | ||
165 | + } | ||
166 | + | ||
167 | + // Class funcs | ||
168 | + | ||
169 | + // Get CIFilter name by machine readable code object type | ||
170 | + open class func filterName(_ machineReadableCodeObjectType:String) -> String { | ||
171 | + if machineReadableCodeObjectType == AVMetadataObject.ObjectType.qr.rawValue { | ||
172 | + return "CIQRCodeGenerator" | ||
173 | + } else if machineReadableCodeObjectType == AVMetadataObject.ObjectType.pdf417.rawValue { | ||
174 | + return "CIPDF417BarcodeGenerator" | ||
175 | + } else if machineReadableCodeObjectType == AVMetadataObject.ObjectType.aztec.rawValue { | ||
176 | + return "CIAztecCodeGenerator" | ||
177 | + } else if machineReadableCodeObjectType == AVMetadataObject.ObjectType.code128.rawValue { | ||
178 | + return "CICode128BarcodeGenerator" | ||
179 | + } else { | ||
180 | + return "" | ||
181 | + } | ||
182 | + } | ||
183 | + | ||
184 | + // Generate CI related code image | ||
185 | + open class func generateCode(_ contents:String, inputCorrectionLevel: InputCorrectionLevel, filterName:String, targetSize: CGSize? = nil, fillColor: UIColor = .white, strokeColor: UIColor = .black) -> UIImage? { | ||
186 | + | ||
187 | + if filterName.length() > 0 { | ||
188 | + if let filter = CIFilter(name: filterName) { | ||
189 | + filter.setDefaults() | ||
190 | + let inputMessage = contents.data(using: String.Encoding.utf8, allowLossyConversion: false) | ||
191 | + filter.setValue(inputMessage, forKey: "inputMessage") | ||
192 | + if filterName == "CIQRCodeGenerator" { | ||
193 | + filter.setValue(inputCorrectionLevel.rawValue, forKey: "inputCorrectionLevel") | ||
194 | + } | ||
195 | + | ||
196 | + let outputImage = colorizeImage(filter.outputImage, fillColor, strokeColor) | ||
197 | + | ||
198 | + let transform = createImageTransform(targetSize, outputImage) | ||
199 | + | ||
200 | + if let outputImage = outputImage?.transformed(by: transform) { | ||
201 | + if let cgImage = ContextMaker.make().createCGImage(outputImage, from: outputImage.extent) { | ||
202 | + return UIImage(cgImage: cgImage, scale: UIScreen.main.scale, orientation: .up) | ||
203 | + } | ||
204 | + } | ||
205 | + } | ||
206 | + } | ||
207 | + return nil | ||
208 | + } | ||
209 | + | ||
210 | + open class func generateCode(_ contents:String, filterName:String, targetSize: CGSize? = nil, fillColor: UIColor = .white, strokeColor: UIColor = .black) -> UIImage? { | ||
211 | + return self.generateCode(contents, inputCorrectionLevel: .Medium, filterName: filterName, targetSize: targetSize, fillColor: fillColor, strokeColor: strokeColor) | ||
212 | + } | ||
213 | + | ||
214 | + fileprivate static func colorizeImage(_ outputImage: CIImage?, _ fillColor: UIColor, _ strokeColor: UIColor) -> CIImage? { | ||
215 | + if let colorFilter = CIFilter(name: "CIFalseColor") { | ||
216 | + colorFilter.setValue(outputImage, forKey: "inputImage") | ||
217 | + let ciFillColor = CIColor(cgColor: fillColor.cgColor) | ||
218 | + let ciStrokeColor = CIColor(cgColor: strokeColor.cgColor) | ||
219 | + colorFilter.setValue(ciFillColor, forKey: "inputColor1") | ||
220 | + colorFilter.setValue(ciStrokeColor, forKey: "inputColor0") | ||
221 | + return colorFilter.outputImage | ||
222 | + } | ||
223 | + return outputImage | ||
224 | + } | ||
225 | + | ||
226 | + fileprivate static func createImageTransform(_ targetSize: CGSize?, _ image: CIImage?) -> CGAffineTransform { | ||
227 | + if let targetSize = targetSize, let image = image { | ||
228 | + let scaleX: CGFloat = targetSize.width / image.extent.size.width | ||
229 | + let scaleY: CGFloat = targetSize.height / image.extent.size.height | ||
230 | + let scale = min(scaleX, scaleY) | ||
231 | + return CGAffineTransform(scaleX: scale, y: scale) | ||
232 | + } | ||
233 | + return CGAffineTransform(scaleX: 1, y: 1) | ||
234 | + } | ||
235 | + | ||
236 | + // Resize image | ||
237 | + open class func resizeImage(_ source:UIImage, scale:CGFloat) -> UIImage? { | ||
238 | + let width = source.size.width * scale | ||
239 | + let height = source.size.height * scale | ||
240 | + | ||
241 | + UIGraphicsBeginImageContextWithOptions(CGSize(width: width, height: height), false, 0) | ||
242 | + guard let context = UIGraphicsGetCurrentContext() else { return nil } | ||
243 | + context.interpolationQuality = .none | ||
244 | + source.draw(in: CGRect(x: 0, y: 0, width: width, height: height)) | ||
245 | + let target = UIGraphicsGetImageFromCurrentImageContext() | ||
246 | + UIGraphicsEndImageContext() | ||
247 | + return target | ||
248 | + } | ||
249 | + | ||
250 | + open class func resizeImage(_ source:UIImage, targetSize:CGSize, contentMode:UIView.ContentMode) -> UIImage? { | ||
251 | + var x: CGFloat = 0 | ||
252 | + var y: CGFloat = 0 | ||
253 | + var width = targetSize.width | ||
254 | + var height = targetSize.height | ||
255 | + if contentMode == .scaleToFill { // contents scaled to fill | ||
256 | + // Nothing to do | ||
257 | + } else if contentMode == .scaleAspectFill { // contents scaled to fill with fixed aspect. some portion of content may be clipped. | ||
258 | + let targtLength = (targetSize.height > targetSize.width) ? targetSize.height : targetSize.width | ||
259 | + let sourceLength = (source.size.height < source.size.width) ? source.size.height : source.size.width | ||
260 | + let fillScale = targtLength / sourceLength | ||
261 | + width = source.size.width * fillScale | ||
262 | + height = source.size.height * fillScale | ||
263 | + x = (targetSize.width - width) / 2.0 | ||
264 | + y = (targetSize.height - height) / 2.0 | ||
265 | + } else { // contents scaled to fit with fixed aspect. remainder is transparent | ||
266 | + let scaledRect = AVMakeRect(aspectRatio: source.size, insideRect: CGRect(x: 0.0, y: 0.0, width: targetSize.width, height: targetSize.height)) | ||
267 | + width = scaledRect.width | ||
268 | + height = scaledRect.height | ||
269 | + if contentMode == .scaleAspectFit | ||
270 | + || contentMode == .redraw | ||
271 | + || contentMode == .center { | ||
272 | + x = (targetSize.width - width) / 2.0 | ||
273 | + y = (targetSize.height - height) / 2.0 | ||
274 | + } else if contentMode == .top { | ||
275 | + x = (targetSize.width - width) / 2.0 | ||
276 | + y = 0 | ||
277 | + } else if contentMode == .bottom { | ||
278 | + x = (targetSize.width - width) / 2.0 | ||
279 | + y = targetSize.height - height | ||
280 | + } else if contentMode == .left { | ||
281 | + x = 0 | ||
282 | + y = (targetSize.height - height) / 2.0 | ||
283 | + } else if contentMode == .right { | ||
284 | + x = targetSize.width - width | ||
285 | + y = (targetSize.height - height) / 2.0 | ||
286 | + } else if contentMode == .topLeft { | ||
287 | + x = 0 | ||
288 | + y = 0 | ||
289 | + } else if contentMode == .topRight { | ||
290 | + x = targetSize.width - width | ||
291 | + y = 0 | ||
292 | + } else if contentMode == .bottomLeft { | ||
293 | + x = 0 | ||
294 | + y = targetSize.height - height | ||
295 | + } else if contentMode == .bottomRight { | ||
296 | + x = targetSize.width - width | ||
297 | + y = targetSize.height - height | ||
298 | + } | ||
299 | + } | ||
300 | + | ||
301 | + UIGraphicsBeginImageContextWithOptions(targetSize, false, 0) | ||
302 | + guard let context = UIGraphicsGetCurrentContext() else { return nil } | ||
303 | + context.interpolationQuality = CGInterpolationQuality.none | ||
304 | + source.draw(in: CGRect(x: x, y: y, width: width, height: height)) | ||
305 | + let target = UIGraphicsGetImageFromCurrentImageContext() | ||
306 | + UIGraphicsEndImageContext() | ||
307 | + return target | ||
308 | + } | ||
309 | +} |
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 | +// RSCodeReaderViewController.swift | ||
3 | +// RSBarcodesSample | ||
4 | +// | ||
5 | +// Created by R0CKSTAR on 6/12/14. | ||
6 | +// Copyright (c) 2014 P.D.Q. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +import AVFoundation | ||
10 | +import UIKit | ||
11 | + | ||
12 | +open class RSCodeReaderViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate { | ||
13 | + @objc open var device = AVCaptureDevice.default(for: AVMediaType.video) | ||
14 | + @objc open var output = AVCaptureMetadataOutput() | ||
15 | + @objc open var session = AVCaptureSession() | ||
16 | + @objc var videoPreviewLayer: AVCaptureVideoPreviewLayer? | ||
17 | + | ||
18 | + @objc open var focusMarkLayer = RSFocusMarkLayer() | ||
19 | + @objc open var cornersLayer = RSCornersLayer() | ||
20 | + | ||
21 | + @objc open var tapHandler: ((CGPoint) -> Void)? | ||
22 | + @objc open var barcodesHandler: (([AVMetadataMachineReadableCodeObject]) -> Void)? | ||
23 | + | ||
24 | + @objc var ticker: Timer? | ||
25 | + | ||
26 | + @objc open var isCrazyMode = false | ||
27 | + @objc var isCrazyModeStarted = false | ||
28 | + @objc var lensPosition: Float = 0 | ||
29 | + | ||
30 | + fileprivate enum Platform { | ||
31 | + static let isSimulator: Bool = { | ||
32 | + var isSim = false | ||
33 | + #if arch(i386) || arch(x86_64) | ||
34 | + isSim = true | ||
35 | + #endif | ||
36 | + return isSim | ||
37 | + }() | ||
38 | + } | ||
39 | + | ||
40 | + // MARK: Public methods | ||
41 | + | ||
42 | + @objc open func hasFlash() -> Bool { | ||
43 | + if let device = self.device { | ||
44 | + return device.hasFlash | ||
45 | + } | ||
46 | + return false | ||
47 | + } | ||
48 | + | ||
49 | + @objc open func hasTorch() -> Bool { | ||
50 | + if let device = self.device { | ||
51 | + return device.hasTorch | ||
52 | + } | ||
53 | + return false | ||
54 | + } | ||
55 | + | ||
56 | + @objc open func switchCamera() -> AVCaptureDevice.Position { | ||
57 | + if !Platform.isSimulator { | ||
58 | + self.session.stopRunning() | ||
59 | + let captureDevice = self.captureDevice() | ||
60 | + if let device = captureDevice { | ||
61 | + self.device = device | ||
62 | + } | ||
63 | + self.setupCamera() | ||
64 | + self.view.setNeedsLayout() | ||
65 | + self.session.startRunning() | ||
66 | + if let device = self.device { | ||
67 | + return device.position | ||
68 | + } else { | ||
69 | + return .unspecified | ||
70 | + } | ||
71 | + } else { | ||
72 | + return .unspecified | ||
73 | + } | ||
74 | + } | ||
75 | + | ||
76 | + @discardableResult | ||
77 | + @objc open func toggleTorch() -> Bool { | ||
78 | + if self.hasTorch() { | ||
79 | + self.session.beginConfiguration() | ||
80 | + if let device = self.device { | ||
81 | + do { | ||
82 | + try device.lockForConfiguration() | ||
83 | + } catch _ {} | ||
84 | + | ||
85 | + if device.torchMode == .off { | ||
86 | + device.torchMode = .on | ||
87 | + } else if device.torchMode == .on { | ||
88 | + device.torchMode = .off | ||
89 | + } | ||
90 | + | ||
91 | + device.unlockForConfiguration() | ||
92 | + self.session.commitConfiguration() | ||
93 | + | ||
94 | + return device.torchMode == .on | ||
95 | + } | ||
96 | + } | ||
97 | + return false | ||
98 | + } | ||
99 | + | ||
100 | + // MARK: Private methods | ||
101 | + | ||
102 | + @objc func captureDevice() -> AVCaptureDevice? { | ||
103 | + if let device = self.device { | ||
104 | + guard device.position == .back || device.position == .front else { | ||
105 | + return nil | ||
106 | + } | ||
107 | + let position = device.position == .back ? AVCaptureDevice.Position.front : AVCaptureDevice.Position.back | ||
108 | + if #available(iOS 10.0, *) { | ||
109 | + let devices = AVCaptureDevice.DiscoverySession(deviceTypes: [AVCaptureDevice.DeviceType.builtInWideAngleCamera], mediaType: AVMediaType.video, position: position).devices | ||
110 | + return devices.first | ||
111 | + } else { | ||
112 | + for device: AVCaptureDevice in AVCaptureDevice.devices(for: AVMediaType.video) { | ||
113 | + if device.position == position { | ||
114 | + return device | ||
115 | + } | ||
116 | + } | ||
117 | + } | ||
118 | + } | ||
119 | + return nil | ||
120 | + } | ||
121 | + | ||
122 | + @objc func setupCamera() { | ||
123 | + var error: NSError? | ||
124 | + let input: AVCaptureDeviceInput! | ||
125 | + do { | ||
126 | + guard let device = self.device else { return } | ||
127 | + input = try AVCaptureDeviceInput(device: device) | ||
128 | + } catch let error1 as NSError { | ||
129 | + error = error1 | ||
130 | + input = nil | ||
131 | + } | ||
132 | + if let error = error { | ||
133 | + print(error.description) | ||
134 | + return | ||
135 | + } | ||
136 | + | ||
137 | + if let device = self.device { | ||
138 | + do { | ||
139 | + try device.lockForConfiguration() | ||
140 | + if device.isFocusModeSupported(.continuousAutoFocus) { | ||
141 | + device.focusMode = .continuousAutoFocus | ||
142 | + } | ||
143 | + if device.isAutoFocusRangeRestrictionSupported { | ||
144 | + device.autoFocusRangeRestriction = .near | ||
145 | + } | ||
146 | + device.unlockForConfiguration() | ||
147 | + } catch _ {} | ||
148 | + } | ||
149 | + | ||
150 | + // Remove previous added inputs from session | ||
151 | + for input in self.session.inputs { | ||
152 | + self.session.removeInput(input) | ||
153 | + } | ||
154 | + if self.session.canAddInput(input) { | ||
155 | + self.session.addInput(input) | ||
156 | + } | ||
157 | + | ||
158 | + if let videoPreviewLayer = self.videoPreviewLayer { | ||
159 | + videoPreviewLayer.removeFromSuperlayer() | ||
160 | + } | ||
161 | + self.videoPreviewLayer = AVCaptureVideoPreviewLayer(session: self.session) | ||
162 | + if let videoPreviewLayer = self.videoPreviewLayer { | ||
163 | + videoPreviewLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill | ||
164 | + videoPreviewLayer.frame = self.view.bounds | ||
165 | + self.view.layer.insertSublayer(videoPreviewLayer, at: 0) | ||
166 | + } | ||
167 | + | ||
168 | + if self.output.metadataObjectsDelegate == nil | ||
169 | + || self.output.metadataObjectsCallbackQueue == nil | ||
170 | + { | ||
171 | + let queue = DispatchQueue(label: "com.pdq.rsbarcodes.metadata", attributes: DispatchQueue.Attributes.concurrent) | ||
172 | + self.output.setMetadataObjectsDelegate(self, queue: queue) | ||
173 | + } | ||
174 | + // Remove previous added outputs from session | ||
175 | + var metadataObjectTypes: [AVMetadataObject.ObjectType]? | ||
176 | + for output in self.session.outputs { | ||
177 | + if let output = output as? AVCaptureMetadataOutput { | ||
178 | + metadataObjectTypes = output.metadataObjectTypes | ||
179 | + } | ||
180 | + self.session.removeOutput(output) | ||
181 | + } | ||
182 | + if self.session.canAddOutput(self.output) { | ||
183 | + self.session.addOutput(self.output) | ||
184 | + if let metadataObjectTypes = metadataObjectTypes { | ||
185 | + self.output.metadataObjectTypes = metadataObjectTypes | ||
186 | + } else { | ||
187 | + self.output.metadataObjectTypes = self.output.availableMetadataObjectTypes | ||
188 | + } | ||
189 | + } | ||
190 | + | ||
191 | + self.reloadVideoOrientation() | ||
192 | + } | ||
193 | + | ||
194 | + @objc class func interfaceOrientationToVideoOrientation(_ orientation: UIInterfaceOrientation) -> AVCaptureVideoOrientation { | ||
195 | + switch orientation { | ||
196 | + case .unknown: | ||
197 | + fallthrough | ||
198 | + case .portrait: | ||
199 | + return AVCaptureVideoOrientation.portrait | ||
200 | + case .portraitUpsideDown: | ||
201 | + return AVCaptureVideoOrientation.portraitUpsideDown | ||
202 | + case .landscapeLeft: | ||
203 | + return AVCaptureVideoOrientation.landscapeLeft | ||
204 | + case .landscapeRight: | ||
205 | + return AVCaptureVideoOrientation.landscapeRight | ||
206 | + @unknown default: | ||
207 | + return AVCaptureVideoOrientation.portrait | ||
208 | + } | ||
209 | + } | ||
210 | + | ||
211 | + @objc func reloadVideoOrientation() { | ||
212 | + guard let videoPreviewLayer = self.videoPreviewLayer else { | ||
213 | + return | ||
214 | + } | ||
215 | + guard (videoPreviewLayer.connection?.isVideoOrientationSupported)! else { | ||
216 | + print("isVideoOrientationSupported is false") | ||
217 | + return | ||
218 | + } | ||
219 | + | ||
220 | + let statusBarOrientation = UIApplication.shared.statusBarOrientation | ||
221 | + let videoOrientation = RSCodeReaderViewController.interfaceOrientationToVideoOrientation(statusBarOrientation) | ||
222 | + | ||
223 | + if videoPreviewLayer.connection?.videoOrientation == videoOrientation { | ||
224 | + print("no change to videoOrientation") | ||
225 | + return | ||
226 | + } | ||
227 | + | ||
228 | + videoPreviewLayer.connection?.videoOrientation = videoOrientation | ||
229 | + videoPreviewLayer.removeAllAnimations() | ||
230 | + } | ||
231 | + | ||
232 | + @objc func autoUpdateLensPosition() { | ||
233 | + self.lensPosition += 0.01 | ||
234 | + if self.lensPosition > 1 { | ||
235 | + self.lensPosition = 0 | ||
236 | + } | ||
237 | + if let device = self.device { | ||
238 | + do { | ||
239 | + try device.lockForConfiguration() | ||
240 | + device.setFocusModeLocked(lensPosition: self.lensPosition, completionHandler: nil) | ||
241 | + device.unlockForConfiguration() | ||
242 | + } catch _ {} | ||
243 | + } | ||
244 | + if self.session.isRunning { | ||
245 | + let when = DispatchTime.now() + Double(Int64(10 * Double(USEC_PER_SEC))) / Double(NSEC_PER_SEC) | ||
246 | + DispatchQueue.main.asyncAfter(deadline: when) { | ||
247 | + self.autoUpdateLensPosition() | ||
248 | + } | ||
249 | + } | ||
250 | + } | ||
251 | + | ||
252 | + @objc func onTick() { | ||
253 | + if let ticker = self.ticker { | ||
254 | + ticker.invalidate() | ||
255 | + } | ||
256 | + self.cornersLayer.cornersArray = [] | ||
257 | + } | ||
258 | + | ||
259 | + @objc func onTap(_ gesture: UITapGestureRecognizer) { | ||
260 | + let tapPoint = gesture.location(in: self.view) | ||
261 | + let focusPoint = CGPoint( | ||
262 | + x: tapPoint.x / self.view.bounds.size.width, | ||
263 | + y: tapPoint.y / self.view.bounds.size.height) | ||
264 | + | ||
265 | + if let device = self.device { | ||
266 | + do { | ||
267 | + try device.lockForConfiguration() | ||
268 | + if device.isFocusPointOfInterestSupported { | ||
269 | + device.focusPointOfInterest = focusPoint | ||
270 | + } else { | ||
271 | + print("Focus point of interest not supported.") | ||
272 | + } | ||
273 | + if self.isCrazyMode { | ||
274 | + if device.isFocusModeSupported(.locked) { | ||
275 | + device.focusMode = .locked | ||
276 | + } else { | ||
277 | + print("Locked focus not supported.") | ||
278 | + } | ||
279 | + if !self.isCrazyModeStarted { | ||
280 | + self.isCrazyModeStarted = true | ||
281 | + DispatchQueue.main.async { () -> Void in | ||
282 | + self.autoUpdateLensPosition() | ||
283 | + } | ||
284 | + } | ||
285 | + } else { | ||
286 | + if device.isFocusModeSupported(.continuousAutoFocus) { | ||
287 | + device.focusMode = .continuousAutoFocus | ||
288 | + } else if device.isFocusModeSupported(.autoFocus) { | ||
289 | + device.focusMode = .autoFocus | ||
290 | + } else { | ||
291 | + print("Auto focus not supported.") | ||
292 | + } | ||
293 | + } | ||
294 | + if device.isAutoFocusRangeRestrictionSupported { | ||
295 | + device.autoFocusRangeRestriction = .none | ||
296 | + } else { | ||
297 | + print("Auto focus range restriction not supported.") | ||
298 | + } | ||
299 | + device.unlockForConfiguration() | ||
300 | + self.focusMarkLayer.point = tapPoint | ||
301 | + } catch _ {} | ||
302 | + } | ||
303 | + | ||
304 | + if let tapHandler = self.tapHandler { | ||
305 | + tapHandler(tapPoint) | ||
306 | + } | ||
307 | + } | ||
308 | + | ||
309 | + @objc func onApplicationWillEnterForeground() { | ||
310 | + if !Platform.isSimulator { | ||
311 | + self.session.startRunning() | ||
312 | + } | ||
313 | + } | ||
314 | + | ||
315 | + @objc func onApplicationDidEnterBackground() { | ||
316 | + if !Platform.isSimulator { | ||
317 | + self.session.stopRunning() | ||
318 | + } | ||
319 | + } | ||
320 | + | ||
321 | + // MARK: Deinitialization | ||
322 | + | ||
323 | + deinit { | ||
324 | + print("RSCodeReaderViewController deinit") | ||
325 | + } | ||
326 | + | ||
327 | + // MARK: View lifecycle | ||
328 | + | ||
329 | + override open func viewDidLayoutSubviews() { | ||
330 | + super.viewDidLayoutSubviews() | ||
331 | + let frame = self.view.bounds | ||
332 | + self.videoPreviewLayer?.frame = frame | ||
333 | + self.focusMarkLayer.frame = frame | ||
334 | + self.cornersLayer.frame = frame | ||
335 | + } | ||
336 | + | ||
337 | + override open func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { | ||
338 | + super.viewWillTransition(to: size, with: coordinator) | ||
339 | + coordinator.animate(alongsideTransition: nil, completion: { [weak self] _ in | ||
340 | + DispatchQueue.main.async { | ||
341 | + self?.reloadVideoOrientation() | ||
342 | + } | ||
343 | + }) | ||
344 | + } | ||
345 | + | ||
346 | + override open func viewDidLoad() { | ||
347 | + super.viewDidLoad() | ||
348 | + | ||
349 | + self.view.backgroundColor = UIColor.clear | ||
350 | + | ||
351 | + self.setupCamera() | ||
352 | + | ||
353 | + let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(RSCodeReaderViewController.onTap(_:))) | ||
354 | + self.view.addGestureRecognizer(tapGestureRecognizer) | ||
355 | + | ||
356 | + self.focusMarkLayer.frame = self.view.bounds | ||
357 | + self.view.layer.insertSublayer(self.focusMarkLayer, above: self.videoPreviewLayer) | ||
358 | + | ||
359 | + self.cornersLayer.frame = self.view.bounds | ||
360 | + self.view.layer.insertSublayer(self.cornersLayer, above: self.videoPreviewLayer) | ||
361 | + } | ||
362 | + | ||
363 | + override open func viewWillAppear(_ animated: Bool) { | ||
364 | + super.viewWillAppear(animated) | ||
365 | + | ||
366 | + NotificationCenter.default.addObserver(self, selector: #selector(RSCodeReaderViewController.onApplicationWillEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil) | ||
367 | + NotificationCenter.default.addObserver(self, selector: #selector(RSCodeReaderViewController.onApplicationDidEnterBackground), name: UIApplication.didEnterBackgroundNotification, object: nil) | ||
368 | + | ||
369 | + if !Platform.isSimulator { | ||
370 | + self.session.startRunning() | ||
371 | + } | ||
372 | + } | ||
373 | + | ||
374 | + override open func viewDidDisappear(_ animated: Bool) { | ||
375 | + super.viewDidDisappear(animated) | ||
376 | + | ||
377 | + NotificationCenter.default.removeObserver(self, name: UIApplication.willEnterForegroundNotification, object: nil) | ||
378 | + NotificationCenter.default.removeObserver(self, name: UIApplication.didEnterBackgroundNotification, object: nil) | ||
379 | + if !Platform.isSimulator { | ||
380 | + self.session.stopRunning() | ||
381 | + } | ||
382 | + } | ||
383 | + | ||
384 | + // MARK: AVCaptureMetadataOutputObjectsDelegate | ||
385 | + | ||
386 | + public func metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) { | ||
387 | + var barcodeObjects: [AVMetadataMachineReadableCodeObject] = [] | ||
388 | + var cornersArray: [[Any]] = [] | ||
389 | + for metadataObject in metadataObjects { | ||
390 | + if let videoPreviewLayer = self.videoPreviewLayer { | ||
391 | + if let transformedMetadataObject = videoPreviewLayer.transformedMetadataObject(for: metadataObject) { | ||
392 | + if transformedMetadataObject.isKind(of: AVMetadataMachineReadableCodeObject.self) { | ||
393 | + let barcodeObject = transformedMetadataObject as! AVMetadataMachineReadableCodeObject | ||
394 | + barcodeObjects.append(barcodeObject) | ||
395 | + #if !targetEnvironment(simulator) | ||
396 | + cornersArray.append(barcodeObject.corners) | ||
397 | + #endif | ||
398 | + } | ||
399 | + } | ||
400 | + } | ||
401 | + } | ||
402 | + | ||
403 | + self.cornersLayer.cornersArray = cornersArray | ||
404 | + | ||
405 | + if barcodeObjects.count > 0 { | ||
406 | + if let barcodesHandler = self.barcodesHandler { | ||
407 | + barcodesHandler(barcodeObjects) | ||
408 | + } | ||
409 | + } | ||
410 | + | ||
411 | + DispatchQueue.main.async { () -> Void in | ||
412 | + if let ticker = self.ticker { | ||
413 | + ticker.invalidate() | ||
414 | + } | ||
415 | + self.ticker = Timer.scheduledTimer(timeInterval: 0.4, target: self, selector: #selector(RSCodeReaderViewController.onTick), userInfo: nil, repeats: true) | ||
416 | + } | ||
417 | + } | ||
418 | +} |
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}/. | ... | ... |
WarplySDKFrameworkIOS/Pods/Target Support Files/RSBarcodes_Swift/RSBarcodes_Swift-Info.plist
0 → 100644
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> |
WarplySDKFrameworkIOS/Pods/Target Support Files/RSBarcodes_Swift/RSBarcodes_Swift-umbrella.h
0 → 100644
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 | + |
WarplySDKFrameworkIOS/Pods/Target Support Files/RSBarcodes_Swift/RSBarcodes_Swift.debug.xcconfig
0 → 100644
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 |
WarplySDKFrameworkIOS/Pods/Target Support Files/RSBarcodes_Swift/RSBarcodes_Swift.release.xcconfig
0 → 100644
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> | ... | ... |
No preview for this file type
-
Please register or login to post a comment