摘要:
import Foundation /* 1.class表示类的关键字 2.class后面表示类名 3.类名后面的大括号内表示类的内部 */ /* 1.属性封装了set和get方法 2.方法里面封装了具体的代码块 3.类封装了属性和方法 4.一个项目封装了多个类 */ class Person { 阅读全文
posted @ 2016-02-01 17:47
Rinpe
阅读(166)
评论(0)
推荐(0)
摘要:
swift 和 OC 的桥接 //: Playground - noun: a place where people can play import UIKit var PI = "3.14" // Double(PI) // 将swift的字符串转换为OC的字符串, 调用OC中的函数 (PI as 阅读全文
posted @ 2016-02-01 15:38
Rinpe
阅读(218)
评论(0)
推荐(0)
摘要:
更简洁的if-let import UIKit func attack(name: String, enemyName: String, weapon: String) { print("\(name)使用了\(weapon)攻击了\(enemyName)") } attack("Rinpe", e 阅读全文
posted @ 2016-02-01 14:57
Rinpe
阅读(182)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can play import UIKit /* 这里的枚举没有给它的成员默认值, 而是给它绑定了一个类型, 之后可以在程序中对这些成员进行赋值 */ enum Barcode { case UPCA(Int, 阅读全文
posted @ 2016-02-01 11:09
Rinpe
阅读(185)
评论(0)
推荐(0)
摘要:
//: Playground - noun: a place where people can play import UIKit enum Month: Int { // 这么定义, 后面的Feb, Mar会自动赋值为2和3.. case Jan = 1, Feb, Mar, Apr, May, 阅读全文
posted @ 2016-02-01 10:50
Rinpe
阅读(977)
评论(0)
推荐(0)

浙公网安备 33010602011771号