Xcode本身带有编码常用的代码块可供使用,如下图

例如 “if” 这个代码块的定义

调用方法
1.可以直接拖放带编辑区

2.使用快捷键,键入 “if”, Xcode就会出现自动完成的提示

用户也可以自定义自己常用的代码块:
1.编写代码

2.选择代码,在选择的代码上长按鼠标左键直至光标符号变成鼠标图案
3.拖放到块代码区

4.点击图标,打开代码块

5.点击 “Edit”,进行设置

6.设置块代码名字,快捷提示
7.设置可替换字符
将 name 替换为 <#name#> 占位符,在自动完成代码之后可以自动选定到手动编码的位置
@PRoperty(nonatomic, copy) NSString *<#name#>;