I am trying to is iBeacon, I learned something from Youtube. This is find the closest Beacon by proximity, but it's not very accurate. So I want to find the closest one by rssi. How should I modify the code? The value of rssi always negative, does it mean the the greater the rssi is, the closest?
func locationManager(manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], inRegion region: CLBeaconRegion) {
//print(beacons)
let knownBeacons = beacons.filter{ $0.proximity != CLProximity.Unknown }
//print(knownBeacons)
if(knownBeacons.count>0){
let closestBeacon = knownBeacons[0] as CLBeacon
self.showName.text = self.name[closestBeacon.minor.integerValue]
}
}