LoginSignup
4

More than 5 years have passed since last update.

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

Last updated at Posted at 2018-06-12

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

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")

で取得

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4