摘要:
swift 和 OC 的桥接 //: Playground - noun: a place where people can play import UIKit var PI = "3.14" // Double(PI) // 将swift的字符串转换为OC的字符串, 调用OC中的函数 (PI as 阅读全文
摘要:
//: Playground - noun: a place where people can play import UIKit /* 这里的枚举没有给它的成员默认值, 而是给它绑定了一个类型, 之后可以在程序中对这些成员进行赋值 */ enum Barcode { case UPCA(Int, 阅读全文
摘要:
//: Playground - noun: a place where people can play import UIKit enum Month: Int { // 这么定义, 后面的Feb, Mar会自动赋值为2和3.. case Jan = 1, Feb, Mar, Apr, May, 阅读全文
摘要:
//: Playground - noun: a place where people can play import UIKit // 创建一个枚举类型就相当于创建了一个新的数据类型, 所以首字母应该大写 enum GameEnding { case win case lose case draw 阅读全文
摘要:
//: Playground - noun: a place where people can play import UIKit // 值类型:指的是当一个变量赋值给另外一个变量的时候, 是copy一个副本 // 两个变量之间互不影响, 也就是说, 另外一个变量的值改变, 不会影响到另外一个变量 阅读全文
摘要:
//: Playground - noun: a place where people can play import UIKit // 初始化一个整数数组 var arr = [1, 3, 5, 7, 8, 10, 12, 2, 0, 11, 9] // 闭包原始模样 arr.sort(){(a: 阅读全文