ios - How do I cast an NSDictionary to a swift dictionary if the NSDictionary has integers for keys -
i have dictionary stored in plist has imbedded dictionary in it. if use strings keys can use code below cast swift dictionary:
let namesdict = nsdictionary(contentsoffile: path!) var names = namesdict [string: [string : string]]
however if try use integers keys in root dictionary can't work. code below doesn't work , returns error: "value type not bridged objective-c"
let namesdict = nsdictionary(contentsoffile: path!) var names = namesdict [int: [string : string]]
i have tried intvalue, doesn't work either. missing?
from apple's nsdictionary reference:
in general, key can object (provided conforms nscopying protocol—see below), note when using key-value coding key must string (see key-value coding fundamentals).
plist key-value coding compliant
Comments
Post a Comment