changjiashuai's blog

Runnig...

The future belongs to those who believe in the beauty of their dreams.


Swift基础---Assertions

let age = -3
assert(age >=0, "A person's age cannot be less than zero")

// this causes the assertion to trigger, because age is not >= 0
最近的文章

Swift---泛型(Generics)

泛型使您能够编写灵活的、可重用的功能和类型的代码。 例如要交换两个变量值的问题不用泛型//Int类型交换func swapTwoInts(inout a: Int, inout b: Int){ let temp = a a = b b = temp}var someInt = 3var anotherInt = 107swapTwoInts(&someInt, &anotherInt)println("someInt is now \(someInt), and ...…

继续阅读
更早的文章

Swift基础---类型别名

如何定义typealias AudioSample = UInt16var maxAmplitudeFound = AudioSample.min //0…

继续阅读