Convert Swift Dictionary to String

后端 未结 4 496
日久生厌
日久生厌 2021-02-02 06:10

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

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-02 06:29

    Just use the description property of CustomStringConvertible as

    Example:

    Note: Prior to Swift 3 (or perhaps before), CustomStringConvertible was known as Printable.

提交回复
热议问题