How do you want to store the values received from AddView? First off, I probably should have provided the code for CardRow:
import SwiftUI
import CoreImage.CIFilterBuiltins
struct CardRow: View {
let context = CIContext()
let filter = CIFilter.qrCodeGenerator()
let cname: String
let name: String
let id: String
func generateQRCode(from string: String) -> UIImage {
let data = Data(string.utf8)
filter.setValue(data, forKey: "inputMessage")
if let outputImage = filter.outputImage {
if let cgimg = context.createCGImage(outputImage, from: outputImage.extent) {
return UIImage(cgImage: cgimg)
}
}
return UIImage(systemName: "xmark.circle") ?? UIImage()
}
var body: some View {
HStack {
Image(uiImage: generateQRCode(from: id))
.interpolation(.none)
.resizable()
.scaledToFit()
.frame(width: 87.5, height: 87.5)
.cornerRadius(5)
VStack(alignment: .leading) {
Text(cname)
.font(.title)
.bold()
Text(name)
.font(.headline)
.bold()
Text(id)
.font(.subheadline)
}
}
}
}
And second, like I said in my original post, I want the data to pass through CardRow so it can show in the List in CardsView. And I also need to know the right declaration of name, id, cname, and qrcode. Whether it's a let or a var (or neither) and if it's a String or a Double (or neither). Sorry if this is not your answer, I just need some elaboration 😁.