how to convert data to string in swift 4 code example Example: conert data to string swift let str = String(decoding: data, as: UTF8.self)