从嵌套的NSDictionary读取值

时间:2018-09-16 20:28:44

标签: ios swift xcode nested nsdictionary

在访问NSDictionary中的值时遇到麻烦,我想读取“ user5”键的值,我无法弄清楚正在发生什么或如何访问该值,我已附上了屏幕截图创建断点时由调试器产生: [这里] [1]

感谢您可以提供的任何帮助:)

2 个答案:

答案 0 :(得分:0)

您可以尝试

data Twice a = Twice a a deriving (Show)

instance Functor Twice where
    fmap f (Twice a a) = Twice (f a) (f a)

instance Applicative Twice where
    pure x = (Twice x) x
    Twice f f <*> Twice x x = Twice ((f x) (f x))

答案 1 :(得分:0)

let data = NSDictionary()
print((datat.value(forKey: "Key1") as! NSDictionary).value(forKey: "Key2") as! String)