swift中实现description

//swift,如果要实现description方法,需要遵守一个协议:Printable

override var description:String {

   let properties = [“属性1”,”属性2”,”属性3”]

   return "\(dictionaryWithValuesForKeys(properties))"

}


但是从swift2.0开始,   CustomStringConvertible 替换了 Printable

你可能感兴趣的:(ios,swift,description)