Closed sschizas closed 8 years ago
let dic:[String:String] = [
"phone": "123",
"code": "090"
]
var mpDic = [MessagePackValue:MessagePackValue]()
for (key,value) in dic
{
mpDic[MessagePackValue(key)] = MessagePackValue(value)
}
let packed = MessagePackValue(mpDic)
print(packed)
Thank you very much for your reply. What if the dictionary is [String: AnyObject] ?
@n3trino In that case, you need to figure out what time of object each value is so you can convert it to the correct MessagePackValue
case.
Although question was vague, it was answered. Closing until further discussion is needed.
Can you please provide me with an example how to pack a Dictionary<String, AnyObject> to msg-pack?