Marcus Leon Marcus Leon - 1 year ago 61
Swift Question

Viewing NSData contents in Xcode (Swift)

I'm trying to see the contents of an NSData variable

in the Xcode debugger. This question asks the same thing but regards to an Objective C pointer to an NSData variable. How can you do this with a Swift NSData variable?

Note in this case the data is a String.

Answer Source

If you want to see the string representation of your NSData variable you can use the following code in the debugger

po NSString(data: yourData, encoding: NSUTF8StringEncoding)