目录
一、代码命名基础
.............................................................................................................................
1
1.通用原则
.................................................................................................................................
1
1.1 清晰
.............................................................................................................................
1
1.2 一致
.............................................................................................................................
1
1.3 避免自引用(self Reference)
...............................................................................
2
2.前缀
.........................................................................................................................................
2
3.书写约定
.................................................................................................................................
2
4.Class 与 Protocol 命名
.........................................................................................................
3
二、方法
.............................................................................................................................................
4
1.通用原则
................................................................................................................................
4
2.getter 和 setter 方法(Accessor Methods)
....................................................................
5
3.Delegate 方法
........................................................................................................................
6
4.集合方法
..............................................................................................................................
7
5.方法参数
................................................................................................................................
7
6.私有方法
.................................................................................................................................
8
三、函数
.............................................................................................................................................
8
四、Property 及其他
........................................................................................................................
9
1.Property 与实例变量
.............................................................................................................
9
1.1 Property
.......................................................................................................................
9
1.2 实例变量
.....................................................................................................................
9
2.常量
....................................................................................................................................
10
2.1 枚举常量
...................................................................................................................
10
2.2 使用 const 关键字的常量
.....................................................................................
10
2.3 其他常量类型
........................................................................................................
10
3.Notifications 与 Exceptions
...............................................................................................
11
3.1 Notifications
..........................................................................................................
11
3.2 Exceptions
.............................................................................................................
11
五、缩写
...........................................................................................................................................
11
六、给 Framework 开发者的一些技术提示
................................................................................
12
1.初始化
...................................................................................................................................
13
1.1Class 初始化
..............................................................................................................
13
1.2 指定初始化方法
........................................................................................................
13
1.3 初始化期间的错误检测
............................................................................................
13
2.版本控制和兼容性
.......................................................................................................
14
2.1 框架版本
....................................................................................................................
14
2.2 密钥存档
....................................................................................................................
14
3.异常和错误
...........................................................................................................................
15
4.框架数据
...............................................................................................................................
16
4.1 恒定数据
....................................................................................................................
16
4.2 位字段
........................................................................................................................
16
4.3 内存分配
....................................................................................................................
16
5.对象比较
...............................................................................................................................
17