Swift documentation says
debugDescription = A textual representation of self, suitable for debugging
description = A textual representation of self
in playground i get the output of both call as 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 ?
From Apple documentation:
an object's debug description is the same as its description. However, you can override debugDescription if you want to decouple these; many Cocoa objects do this.
So basically unless you add any extra functionality to your debugDescription it will be the same as description.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With