print() vs dump()
Many of us start debugging with simple print(). Let’s say we have such a class:
class Abc {
let a = "aa"let b = “bb” }
and we have an instance of Abc as so:
let abc = Abc()
When we run the print() on the variable, the output is
App.Abc
while dump() outputs
App.Abc #0
- a: "aa"
- b: "bb"
As seen, dump() outputs the whole class hierarchy, while print() simply outputs the class name.