I have an object that is returned as an AnyObject from a 3rd party SDK, which I have no control over.
The stream gives me a collection of bluetooth devices, and comes in the flavour of:
AnyObject
object [__NSDictionaryM]
[0] = "dataElement" : 4 key/value pairs
[1] = "MACAddress" : ""
[2] = "idString" : ""
[3] = "peripheral": hex_string
[4] = "localName" : "Unnamed"
[5] = "RSSI" : "-40"
I want to check if the device is already contained in another list, by localName, and if not, to add it to my alternate list.
However, I don't want to write a loop on deviceList and then another loop on the element in the loop, just to get to the name; this is counter intuitive, where in a language like C# you can just do deviceList["localName"] to get the value.
As I'm not Swift expert, and having tried casting it to various forms of NSDictionary without success, was wondering if there is a way I can do this without nested loops?
