将任何 Swift 类型转换为 Data,并从 Data 初始化任何 Swift 类型。
// T can be Data, String, Int, Int8, Int16, Int32, Int64, Float, Double, Date, Array, Set, Dictionary
let x: T
// Return the content of x as Data
x.binaryData
// Initialize an instance of type T from the content of a Data value
let y = T(binaryData: d)
作者: Raphaël Wach