Showing
3 changed files
with
32 additions
and
4 deletions
No preview for this file type
No preview for this file type
... | @@ -10,8 +10,8 @@ import SwiftUI | ... | @@ -10,8 +10,8 @@ import SwiftUI |
10 | import Combine | 10 | import Combine |
11 | import Foundation | 11 | import Foundation |
12 | import UIKit | 12 | import UIKit |
13 | -//import RSBarcodes_Swift | 13 | +import RSBarcodes_Swift |
14 | -//import AVFoundation | 14 | +import AVFoundation |
15 | 15 | ||
16 | 16 | ||
17 | extension CouponBarcodeView { | 17 | extension CouponBarcodeView { |
... | @@ -146,7 +146,7 @@ extension CouponBarcodeView { | ... | @@ -146,7 +146,7 @@ extension CouponBarcodeView { |
146 | } | 146 | } |
147 | .frame(maxWidth: .infinity) | 147 | .frame(maxWidth: .infinity) |
148 | 148 | ||
149 | - if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: "123456789101112"))) { | 149 | + if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: "1234567891234"))) { |
150 | VStack(alignment: .center) { | 150 | VStack(alignment: .center) { |
151 | VStack {} | 151 | VStack {} |
152 | .frame(height: 1) | 152 | .frame(height: 1) |
... | @@ -157,13 +157,41 @@ extension CouponBarcodeView { | ... | @@ -157,13 +157,41 @@ extension CouponBarcodeView { |
157 | .padding(.top, self.uiscreen.height * 0.015) | 157 | .padding(.top, self.uiscreen.height * 0.015) |
158 | 158 | ||
159 | // TODO: Add the barcode | 159 | // TODO: Add the barcode |
160 | +// Image(uiImage: UIImage(ciImage: output)) | ||
161 | + | ||
162 | +// let isValid = RSUnifiedCodeValidator.shared.isValid("1234567891234", machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue) | ||
163 | + | ||
164 | + if let gen = RSUnifiedCodeGenerator.shared { | ||
165 | + | ||
166 | +// gen.fillColor = UIColor.white | ||
167 | +// gen.strokeColor = UIColor.black | ||
168 | + | ||
169 | + if let image = gen.generateCode("1234567891234", machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: 300, height: 300)) { | ||
170 | + | ||
171 | +// VStack(alignment: .center) { | ||
172 | +// Image(uiImage: image) | ||
173 | +// .resizable() | ||
174 | +// .aspectRatio(contentMode: .fit) | ||
175 | +// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.05) | ||
176 | +// | ||
177 | +// } | ||
178 | +// .frame(maxWidth: .infinity) | ||
179 | +// .padding(.top, self.uiscreen.height * 0.01) | ||
180 | + | ||
181 | + Image(uiImage: image) | ||
182 | +// .resizable() | ||
183 | +// .aspectRatio(contentMode: .fit) | ||
184 | +// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.05) | ||
185 | + } | ||
186 | + } | ||
187 | + | ||
160 | // generateBarcode(from: "1234567891234") | 188 | // generateBarcode(from: "1234567891234") |
161 | // ? | 189 | // ? |
162 | // .resizable() | 190 | // .resizable() |
163 | // .aspectRatio(contentMode: .fit) | 191 | // .aspectRatio(contentMode: .fit) |
164 | // .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1) | 192 | // .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1) |
165 | 193 | ||
166 | - Text("123456789101112") | 194 | + Text("1234567891234") |
167 | .fontWeight(.regular) | 195 | .fontWeight(.regular) |
168 | .font(.system(size: 22)) | 196 | .font(.system(size: 22)) |
169 | .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | 197 | .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ... | ... |
-
Please register or login to post a comment