For testing and debugging I am trying to put the content of Dictionary to a String. But have no clue hows it going to achieve. Is it possible? If yes, how.
Dictionary is fetched from web service so I have no idea the key values it have. I want to use the data in app.
In Objective C %@ was enough to store anything in NSString.
Dictionary to string with custom format:
Just use the
description
property ofCustomStringConvertible
asNote: Prior to Swift 3 (or perhaps before),
CustomStringConvertible
was known asPrintable
.You can just print a dictionary directly without embedding it into a string:
Or you can embed it in a string like this: