Marcus Leon Marcus Leon - 7 months ago 15
Swift Question

Viewing NSData contents in Xcode (Swift)

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

data
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

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)
Comments