Nested Dictionary in my swift application

You can try

if  let sprites = pokemonDictionary["sprites"] as? [String:Any] {

      print(sprites)

   if  let backImgUrl = sprites["back_default"] as? String {

        print(backImgUrl)
    }

}

Also you should run function named CallUrl in a thread other than the main , as Data(contentsOf:) runs synchronously and blocks the main thread

Leave a Comment