为类型取别名
Swift语言中使用typeealias关键词为某个类型取一个别名,实例如下:
// 为Int类型取一个别名Price
typealias Price = Int
// 使用Price代替Int效果完全一样
var penPrice: Price = 100
Swift语言中使用typeealias关键词为某个类型取一个别名,实例如下:
// 为Int类型取一个别名Price
typealias Price = Int
// 使用Price代替Int效果完全一样
var penPrice: Price = 100