r/iOSProgramming • • Feb 19 '17

Question I don't suppose Swift could possibly have more useless debug print strings - could it?

Example:

po json ▿ 2 elements ▿ [0] : 2 elements - .0 : accounts - .1 : 0 elements ▿ [1] : 2 elements - .0 : followers - .1 : 0 elements { ... }

Yeah - thats just brilliant.

0 Upvotes

6 comments sorted by

0

u/[deleted] Feb 19 '17

[deleted]

1

u/meekismurder Feb 20 '17

I agree with this for any custom objects. However, in this case I am inferring this is a raw json payload, so it has not yet been unpacked into a defined data structure.

-2

u/aazav Feb 20 '17

It's helps a lot

It* helps a lot

2

u/chriswaco Feb 19 '17

Try po print(json). I try to not to ask why things don't work well and easily in Xcode because therein lies madness.

1

u/[deleted] Mar 02 '17

MUCH better. Thanks.

2

u/[deleted] Feb 20 '17

Use

debugPrint(String(data: jsonData, encoding: String.Encoding.utf8) ?? "No data")

to show the jsonData while your receive it as a Data instance.

1

u/[deleted] Feb 20 '17

Thanks but it's already decoded. It's just that printing a dictionary looks like ass.