Here is my code. It uses CBUUID
which is from Core Bluetooth. Let's just assume the cast of v
is valid.
import UIKit
import CoreBluetooth
func convert(v: AnyObject) -> [String: String] {
return (v as! [CBUUID: NSData]).map { (uuid, data) in
(uuid.UUIDString, NSString(data: data, encoding: NSUTF8StringEncoding) ?? "")
}
}
The idea is to get the string representation of the dictionary by calling CBUUID.UUIDString
for CBUUID
and by calling the appropriate NSString
constructor for NSData
.
I've cast the dictionary to a specific type. Why do I get "ambiguous reference to member 'map'" here?