user481610 user481610 - 6 months ago 31
Swift Question

How to print the content of a variable type Data using swift?

All I am looking to is take a string and get its hex value. I've been following this post, here is the code I have in the playground:

let str = "Say Hello to My Little Friend"
let data =

However, I just printed out this:

"60 bytes\n"

. How do I get the hex value of:




print("\(data! as NSData)")

PS: Your expected hex is .utf8