Convert String to Data


let str : String! = "TEST"

let resData = Data(str.utf8)

Convert Data To String


print(String(decoding: resData, as: UTF8.self))