The idea is to use a code inputed from scanning a bar code to get the information from the database. I have the bar scanning bit done, my problem is using the variable to get the data from the DB.
user interface = SwiftUI
Database = Firebase (Firestore)
the set up between Xcode and firebase is working and I am able to read data. However I want to use a variable as the pathway to the database instead of a constant.
How can I do this?
All of my code → codetofix - Google Drive
I am not very experienced to Xcode and swift but in all I believe this should just be a simple fix where I replace the bit of code
return products(id: d.documentID, name: d["name"] as? String ?? "", scannedCode2: d["scannedCode2"] as? String ?? "", notes: d["notes"] as? String ?? "")
with my var → scannedCode as the file path to the data
nothing is working for me though, and there are lots of problems around using the var I get ‘scannedCode’ form scanning the bar code in different places.
Any help is greatly appreciated thanks!