I'm curious about the xcode debug window

Hi guys,

I hope everyone is having a nice day.

I have a question because i’m very curious about how the debugger windows works in xcode 11.

I just finished module 2, lesson 6 of the database course and there is a section in which you have to parse the data snapshots ( DataSnapshot) coming from firebase. In this part, Chris use the debugger command “po” in order to check what is inside this data snapshot:

[See image number 1 at the end of the post]
[See image number 2 at the end of the post]

My question pops up, when i check the left pane of the debugger. There i can also check the variable “snap”, but it’s quite different from what “po” prints. If i dig into the snap variable in the left panel of the debugger, i can see the key/value pairs of my children object (age: 23, likes: “Ice cream”, etc) but i cannot find the key of the main object (which is “Alvaro”):

[See image number 3 at the end of the post]

Seems like the key of my object is “hidden” in some way, and the “po” command knows how to retrieve it. I just want to know more of how everything works under the scenes. I hope someone can give me some insight about this, it will be much appreciated.

Here is how the data looks in firebase:

[See image number 4 at the end of the post]

Than you very much,

Cheers,
Alvaro

hello, this is because the value being accessed is already a “snap” of the employee named Alvaro

if you look at (1) you will see that it loops the snapshots each each loop having snap

now you changed your snap.value to an array of “string” as the Key, and “Any” as value
this is why you only see a list of the keys and values of that particular employee, if you try to print “snap” itself it will be the whole employee object