Code Snippets 使用

一个偶然的机会,了解了到了xcode一个非常不错的、可以提高代码编写效率的工具,Code Snippets。关于如何使用Code Snippets来设置自己的代码片段,请参考下面这篇文章:
http://blog.csdn.net/wzzvictory/article/details/12163939

文章写的很好、把如何自定义Code Snippets的方法讲的很透彻,唯一的缺点是没有设置快捷键,我整理了一些大家在开发过程中,需要经常用到的代码片段,并且设置了简单的快捷键:
1、PS ,对应:

@property (nonatomic, strong) NSString *<#name#>;

2、PI,对应:

@property(nonatomic, assign) NSInteger <#name#>;

3、PB,对应:

@property (nonatomic, assign) BOOL <#name#>;

4、WS,对应:

__weak typeof(self) weakSelf = self;

5,SS,对应:

__strong typeof(weakSelf) strongSelf = weakSelf;

自定义的Code Snippets可以直接拷贝到别的机器上使用,其目录位于:

~/Library/Developer/Xcode/UserData/CodeSnippets 

我已经将常见的这些 Code Snippets放在了github上,大家可以直接clone下来,放在上述的目录中使用:
https://github.com/xbydev/HBCodeSnippets

猜你喜欢

转载自blog.csdn.net/lvmaker/article/details/77844852
今日推荐