Edited at

[swift]ネストしたDictionaryの取得

More than 1 year has passed since last update.

初歩的だが備忘録てきにメモ

dictionary: {

email = "aaa@a.a";
"first_name" = hoge;
id = xxxxxxxxxxxxxxxxxx;
"last_name" = hoge;
name = "hoge hoge";
picture = {
data = {
height = 200;
"is_silhouette" = 0;
url = "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
width = 200;
};
};
}

こんなDictionaryがあってpicture>data>urlが欲しかったら

let url = dictionary.value(forKeyPath: "picture.data.url")

で取得