What is the difference between debugDescription and array description methods in swift?

Swift documentation says

debugDescription = A textual representation of self, suitable for debugging
description = A textual representation of self

      

in the playground I get the output of both calls as the same

anArray.debugDescription // "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
anArray.description // "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"

      

What is the actual difference between the two?

+3


source to share


1 answer


From Apple documentation:

the description for debugging an object is the same as its description. However, you can override debugDescription if you want to separate them; many Cocoa sites do this.



Basically, unless you add any additional functionality to your debugDescription, it will be the same as the description.

+4


source







All Articles