I found Mac is much better to be used than windows system. The mouse is super good without wheel as the top part of mouse is actually touchable. To do copy/paste you need to use cmd key + C/V.
Following note are from what I learned for swift 3:
Swift simplified memory management using ARC - Automatic Reference Counting.
Using let for constant, var is used for variable:
let oneMillion = 1_000_000
You can use min and max properties for integer type to get maximum and minimum value.// 定义类型别名 typealias
typealias AudioSample = UInt16
// optional binding,只有当yyy是optional的时候才可以这样用。optional的yyy非空时为真,将yyy中的值取出赋给xxx,空时(nil)为假;
if let xxx = yyy {
// do something
} else {
// do other thing
}
// decompose一个tuple时,对于不想使用的元素用’_’接收
let http404Error = (404, "Not Found")
let (justTheStatusCode, _) = http404Error
println("The status code is \(justTheStatusCode)")
// prints "The status code is 404
let possibleNumber = "123"
let convertedNumber = possibleNumber.toInt()
// convertedNumber is inferred to be of type "Int?", or "optional Int”,因为toInt()可能会失败(比如“123a”)导致返回nil
!== and === are identity operators and are used to determine if two objects have the same reference.
var arr1 = [1, 2, 3]
var arr2 = arr1
arr2[0] = 10;
arr1 // [10, 2, 3]
arr2 // [10, 2, 3]
arr1 === arr2 // true
把《The Swift Programming Language》读薄
Introducing Firebase with Swift 3: Login and Sign Up