I am building an app where I have to pass a specific beacon's accuracy to another view controller but that is leading me to a roadblock.
I have tried passing the accuracy by storing it in a variable but when I pass it on to the new view controller the value just gets fixed to what it detected when it was going to the view controller. For e.g. If the beacon's accuracy at the time it transitioned was 3.00 m the value passed to the other view remains 3.00 m and doesn't change
@objc func updateCounting(){
for item in items {
let beac = item.beacon
if beac != nil{
let acc = item.calculateAccuracy(txPower: -70, rssi: Double(beac?.rssi ?? 0))
let prox = beac?.proximity ?? .unknown
if acc < 1.50 && prox != .unknown {
if let Level2 = self.storyboard!.instantiateViewController(withIdentifier: "ReportVC") as? ReportVC {
Level2.passedRes = item.patient
Level2.passedRoom = item.room
Level2.passResImg = item.resImage
Level2.selectedBeacon = beac
self.show(Level2, sender: nil)
break
}
}
}else{
print("No beacon found")
}
}
}
One of the things I tried was passinng the whole beacon to level2 but that didnt work either.