to string swift code example Example: swift + data to string let str = String(decoding: data, as: UTF8.self)