Manos Chorianopoulos

CouponBarcodeView changes

......@@ -10,8 +10,8 @@ import SwiftUI
import Combine
import Foundation
import UIKit
//import RSBarcodes_Swift
//import AVFoundation
import RSBarcodes_Swift
import AVFoundation
extension CouponBarcodeView {
......@@ -146,7 +146,7 @@ extension CouponBarcodeView {
}
.frame(maxWidth: .infinity)
if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: "123456789101112"))) {
if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: "1234567891234"))) {
VStack(alignment: .center) {
VStack {}
.frame(height: 1)
......@@ -157,13 +157,41 @@ extension CouponBarcodeView {
.padding(.top, self.uiscreen.height * 0.015)
// TODO: Add the barcode
// Image(uiImage: UIImage(ciImage: output))
// let isValid = RSUnifiedCodeValidator.shared.isValid("1234567891234", machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue)
if let gen = RSUnifiedCodeGenerator.shared {
// gen.fillColor = UIColor.white
// gen.strokeColor = UIColor.black
if let image = gen.generateCode("1234567891234", machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: 300, height: 300)) {
// VStack(alignment: .center) {
// Image(uiImage: image)
// .resizable()
// .aspectRatio(contentMode: .fit)
// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.05)
//
// }
// .frame(maxWidth: .infinity)
// .padding(.top, self.uiscreen.height * 0.01)
Image(uiImage: image)
// .resizable()
// .aspectRatio(contentMode: .fit)
// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.05)
}
}
// generateBarcode(from: "1234567891234")
// ?
// .resizable()
// .aspectRatio(contentMode: .fit)
// .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1)
Text("123456789101112")
Text("1234567891234")
.fontWeight(.regular)
.font(.system(size: 22))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
......