André Luiz André Luiz - 5 months ago 27
Swift Question

Find the item with the biggest value in a dictionary

I'm implementing some logic to get the closest Beacon and to do that I created a Dictionary where I insert some Measures. My problem is that I don't know how to get the item with the biggest value. Some code below:

struct objBeacon {
var accuracy : Float
var rssi : Float
var positionInList : Float

var readBeacons = [String:objBeacon]()

My goal is to get the item (objBeacon) with the biggest
value, how can I do that without looping through the list?


The simplest way is this


Hope this helps