//MARK:-------swift中的typedef--------------
//使用 keyword定义类型别名,相似typedef
typealias NSInteger = Int
var value : NSInteger = 45
value = 12
print(value);
//MARK:-------String--------------
let label = "The width is "
let width = 94
var widthLabel = label + String(width) //Swift不支持隐式类型转换。须要显式类型转换
widthLabel += "!"
print(widthLabel)
//Swift使用\(item)的形式进行字符串格式化
let apples = 3
let oranges = 5
let appleSummary = "I have \(apples) apples."
let fruitSummary = "I have \(apples + oranges) pieces of fruit."
Swift教程之typealias代替OC的typedef
转载于:https://www.cnblogs.com/yxwkf/p/5146663.html