[swift-users] No hex dump anymore in Data description
martinr448 at gmail.com
Sat Aug 27 01:45:01 CDT 2016
Is it intentional that the description method of Data returns only the number of bytes, but not a hex dump of the contents (as NSData did)?
let data = Data(bytes: [1, 2, 3])
print(data) // 3 bytes
print(data.debugDescription) // 3 bytes
Of course I can bridge back to NSData:
print(data as NSData) // <010203>
But other collection types (Array, Dictionary, Set) print all their elements, regardless of the size of the collection.
For debugging purposes, the "old behavior" of returning a hex dump would be useful.
More information about the swift-users